drm/i915: Insert cond_resched() into i915_gem_free_objects
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 7 Apr 2017 10:25:52 +0000 (11:25 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 7 Apr 2017 12:37:41 +0000 (13:37 +0100)
As we may have very many objects to free, check to see if the task needs
to be rescheduled whilst freeing them.

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-4-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_gem.c

index 9bc4d8917107d77556562c3ea169542f72b66683..b210acc3d0b4e79dc7a7dfe9c09fc0570de37a58 100644 (file)
@@ -4302,6 +4302,8 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
        intel_runtime_pm_put(i915);
        mutex_unlock(&i915->drm.struct_mutex);
 
+       cond_resched();
+
        llist_for_each_entry_safe(obj, on, freed, freed) {
                GEM_BUG_ON(obj->bind_count);
                GEM_BUG_ON(atomic_read(&obj->frontbuffer_bits));