summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorChris Wilson2017-04-07 12:25:51 +0200
committerChris Wilson2017-04-07 14:37:41 +0200
commit5ad08be7e34fc6f3c6936ac40063ea839d4ce0d2 (patch)
tree82eddb09aba8346d0603a7f50c060b3231968296 /drivers/gpu/drm/i915/i915_gem.c
parentdrm/i915: Simplify shrinker locking (diff)
downloadkernel-qcow2-linux-5ad08be7e34fc6f3c6936ac40063ea839d4ce0d2.tar.gz
kernel-qcow2-linux-5ad08be7e34fc6f3c6936ac40063ea839d4ce0d2.tar.xz
kernel-qcow2-linux-5ad08be7e34fc6f3c6936ac40063ea839d4ce0d2.zip
drm/i915: Break up long runs of freeing objects
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 <aarcange@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170407102552.5781-3-chris@chris-wilson.co.uk Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5cfe63e3cb28..9bc4d8917107 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -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)