Commit b42a13d9 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Drain freed objects for mmap space exhaustion

As we now use a deferred free queue for objects, simply retiring the
active objects is not enough to immediately free them and recover their
mmap space - we must now also drain the freed object list.

Fixes: fbbd37b3 ("drm/i915: Move object release to a freelist + worker"
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170106152240.5793-3-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent 1a292fa5
...@@ -2090,23 +2090,21 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj) ...@@ -2090,23 +2090,21 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
int err; int err;
err = drm_gem_create_mmap_offset(&obj->base); err = drm_gem_create_mmap_offset(&obj->base);
if (!err) if (likely(!err))
return 0; return 0;
/* We can idle the GPU locklessly to flush stale objects, but in order /* Attempt to reap some mmap space from dead objects */
* to claim that space for ourselves, we need to take the big do {
* struct_mutex to free the requests+objects and allocate our slot. err = i915_gem_wait_for_idle(dev_priv, I915_WAIT_INTERRUPTIBLE);
*/ if (err)
err = i915_gem_wait_for_idle(dev_priv, I915_WAIT_INTERRUPTIBLE); break;
if (err)
return err;
err = i915_mutex_lock_interruptible(&dev_priv->drm); i915_gem_drain_freed_objects(dev_priv);
if (!err) {
i915_gem_retire_requests(dev_priv);
err = drm_gem_create_mmap_offset(&obj->base); err = drm_gem_create_mmap_offset(&obj->base);
mutex_unlock(&dev_priv->drm.struct_mutex); if (!err)
} break;
} while (flush_delayed_work(&dev_priv->gt.retire_work));
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment