From: Chris Wilson Date: Tue, 7 Mar 2017 20:58:50 +0000 (+0000) Subject: drm/i915/userptr: Only flush the workqueue if required X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d151e9ce9876a134d9c46e191d920292d47d302e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/i915/userptr: Only flush the workqueue if required 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 Cc: Michał Winiarski Cc: Tvrtko Ursulin Link: http://patchwork.freedesktop.org/patch/msgid/20170307205851.32578-2-chris@chris-wilson.co.uk Reviewed-by: Michał Winiarski Reviewed-by: Tvrtko Ursulin --- diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c index 6ef05d5b884d..dc9bf5282071 100644 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c @@ -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 = {