Message ID | 1346788858-19213-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | RFC |
Headers | show |
On Tue, 4 Sep 2012 21:00:58 +0100 Chris Wilson <chris@chris-wilson.co.uk> wrote: > 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... What's the BKM for making the memory all go bye-bye (ie. how to test this patch a bit)?
On Fri, 7 Sep 2012 23:38:05 -0700, Ben Widawsky <ben@bwidawsk.net> wrote: > On Tue, 4 Sep 2012 21:00:58 +0100 > Chris Wilson <chris@chris-wilson.co.uk> wrote: > > > 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... > > What's the BKM for making the memory all go bye-bye (ie. how to test > this patch a bit)? There are a few i-g-t that purposesly exercise resource starvation, or you can just use firefox (which has the added bonus of throwing in signals for free)! -Chris
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