[Intel-gfx] [PATCH] drm/i915: Prevent signals from interrupting memory recovery

Chris Wilson chris at chris-wilson.co.uk
Tue Sep 4 22:00:58 CEST 2012


Just a spark of an idea to see if this is valid.

Given extreme memory pressure where we must zap our own caches and bound
buffers or else we fail to allocate a structure, we have a choice of
propagating that interrupt back to userspace or to quietly suppress it
in the hope of making the allocation. i915_gem_shrink_all() is a likely
candidate for that last ditch effort that currently fails to propagate
the interruption back...
---
 drivers/gpu/drm/i915/i915_gem.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 453335c..353332a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1868,11 +1868,19 @@ static void
 i915_gem_shrink_all(struct drm_i915_private *dev_priv)
 {
 	struct drm_i915_gem_object *obj, *next;
+	bool was_interruptible;
 
-	i915_gem_evict_everything(dev_priv->dev);
+	/* As we are called in a last-ditch attempt to recover memory,
+	 * make sure we wait for any unbind attempts to finish.
+	 */
+	was_interruptible = dev_priv->mm.interruptible;
+	dev_priv->mm.interruptible = false;
 
+	i915_gem_evict_everything(dev_priv->dev);
 	list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list, gtt_list)
 		i915_gem_object_put_pages(obj);
+
+	dev_priv->mm.interruptible = was_interruptible;
 }
 
 static int
-- 
1.7.10.4




More information about the Intel-gfx mailing list