drm/i915/userptr: Only flush the workqueue if required
authorChris Wilson <[email protected]>
Tue, 7 Mar 2017 20:58:50 +0000 (20:58 +0000)
committerChris Wilson <[email protected]>
Thu, 9 Mar 2017 07:30:49 +0000 (07:30 +0000)
To avoid waiting for work from other invalidate-range threads where
not required, only wait on the userptr cancel workqueue if we have added
some work to it.

Signed-off-by: Chris Wilson <[email protected]>
Cc: Michał Winiarski <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Michał Winiarski <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
drivers/gpu/drm/i915/i915_gem_userptr.c

index 6ef05d5b884db3748b2662098864fe41f711670e..dc9bf5282071360a62fc25539ff8f0a1ebff1bc7 100644 (file)
@@ -145,7 +145,8 @@ static void i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier *_mn,
                del_object(mo);
        spin_unlock(&mn->lock);
 
-       flush_workqueue(mn->wq);
+       if (!list_empty(&cancelled))
+               flush_workqueue(mn->wq);
 }
 
 static const struct mmu_notifier_ops i915_gem_userptr_notifier = {