drm/i915: Break up long runs of freeing objects
authorChris Wilson <[email protected]>
Fri, 7 Apr 2017 10:25:51 +0000 (11:25 +0100)
committerChris Wilson <[email protected]>
Fri, 7 Apr 2017 12:37:41 +0000 (13:37 +0100)
Before freeing the next batch of objects from the worker, check if the
worker's timeslice has expired and if so, defer the next batch to the
next invocation of the worker.

Suggested-by: Andrea Arcangeli <[email protected]>
Signed-off-by: Chris Wilson <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Joonas Lahtinen <[email protected]>
drivers/gpu/drm/i915/i915_gem.c

index 5cfe63e3cb28ac2d9f3da4367ffcdba7bc37c54e..9bc4d8917107d77556562c3ea169542f72b66683 100644 (file)
@@ -4349,8 +4349,11 @@ static void __i915_gem_free_work(struct work_struct *work)
         * unbound now.
         */
 
-       while ((freed = llist_del_all(&i915->mm.free_list)))
+       while ((freed = llist_del_all(&i915->mm.free_list))) {
                __i915_gem_free_objects(i915, freed);
+               if (need_resched())
+                       break;
+       }
 }
 
 static void __i915_gem_free_object_rcu(struct rcu_head *head)