Skip to content

Commit ecebca7

Browse files
icklesumitsemwal
authored andcommitted
dma-buf/sync-file: Avoid enable fence signaling if poll(.timeout=0)
If we being polled with a timeout of zero, a nonblocking busy query, we don't need to install any fence callbacks as we will not be waiting. As we only install the callback once, the overhead comes from the atomic bit test that also causes serialisation between threads. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Gustavo Padovan <gustavo@padovan.org> Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linaro-mm-sig@lists.linaro.org Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Link: http://patchwork.freedesktop.org/patch/msgid/20160829181613.30722-1-chris@chris-wilson.co.uk
1 parent f6ce410 commit ecebca7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/dma-buf/sync_file.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ static unsigned int sync_file_poll(struct file *file, poll_table *wait)
306306

307307
poll_wait(file, &sync_file->wq, wait);
308308

309-
if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) {
309+
if (!poll_does_not_wait(wait) &&
310+
!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) {
310311
if (fence_add_callback(sync_file->fence, &sync_file->cb,
311312
fence_check_cb_func) < 0)
312313
wake_up_all(&sync_file->wq);

0 commit comments

Comments
 (0)