All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915: Allow kswapd to pause the device whilst reaping
Date: Fri, 02 Jun 2017 14:58:00 +0100	[thread overview]
Message-ID: <149641188026.3526.2338712717483204350@mail.alporthouse.com> (raw)
In-Reply-To: <87a85qsgxh.fsf@gaia.fi.intel.com>

Quoting Mika Kuoppala (2017-06-02 13:38:34)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > Quoting Mika Kuoppala (2017-06-02 13:02:57)
> >> Chris Wilson <chris@chris-wilson.co.uk> writes:
> >> 
> >> > In commit 5763ff04dc4e ("drm/i915: Avoid GPU stalls from kswapd") we
> >> > stopped direct reclaim and kswapd from triggering GPU/client stalls
> >> > whilst running (by restricting the objects they could reap to be idle).
> >> >
> >> > However with abusive GPU usage, it becomes quite easy to starve kswapd
> >> > of memory and prevent it from making forward progress towards obtaining
> >> > enough free memory (thus driving the system closer to swap exhaustion).
> >> > Relax the previous restriction to allow kswapd (but not direct reclaim)
> >> > to stall the device whilst reaping purgeable pages.
> >> >
> >> > v2: Also acquire the rpm wakelock to allow kswapd to unbind buffers.
> >> >
> >> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> >> > ---
> >> >  drivers/gpu/drm/i915/i915_gem_shrinker.c | 9 +++++++++
> >> >  1 file changed, 9 insertions(+)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> >> > index 0fd2b58ce475..58f27369183c 100644
> >> > --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
> >> > +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> >> > @@ -332,6 +332,15 @@ i915_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
> >> >                                        sc->nr_to_scan - freed,
> >> >                                        I915_SHRINK_BOUND |
> >> >                                        I915_SHRINK_UNBOUND);
> >> > +     if (freed < sc->nr_to_scan && current_is_kswapd()) {
> >> > +             intel_runtime_pm_get(dev_priv);
> >> 
> >> We take extra ref to force device wake and thus force bound objects out?
> >
> > Yes. The shrinker skips the unbind phase if it can't acquire the device
> > wakeref, so we ensure we enter the shrinker with it held.
> >  
> >> > +             freed += i915_gem_shrink(dev_priv,
> >> > +                                      sc->nr_to_scan - freed,
> >> > +                                      I915_SHRINK_ACTIVE |
> >> > +                                      I915_SHRINK_BOUND |
> >> > +                                      I915_SHRINK_UNBOUND);
> >> 
> >> Looking at the shrink code, I am pondering how the stall will happen?
> >> 
> >> There are other callpaths that force gpu idle before kicking out
> >> objects, but for this callpath it seems that we kick out
> >> objects that might be still currently accessed by the gpu.
> >
> > By unbinding an active object, we stall.
> 
> I see that now.
> 
> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

Pushed this as the wakeref alone should make kswapd much more effective.
Perhaps I should have included a fixes, but alas I did not.

I would like to get some traction on the NORETRY patch.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-06-02 13:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 13:33 [PATCH 1/3] drm/i915: Allow kswapd to pause the device whilst reaping Chris Wilson
2017-06-01 13:33 ` [PATCH 2/3] drm/i915: Encourage our shrinker more when our shmemfs allocations fails Chris Wilson
2017-06-01 13:33 ` [PATCH 3/3] drm/i915: Remove __GFP_NORETRY from our buffer allocator Chris Wilson
2017-06-02 10:28   ` Joonas Lahtinen
2017-06-05 10:35   ` [PATCH v2] " Chris Wilson
2017-06-05 10:47     ` Daniel Stone
2017-06-05 11:51       ` Chris Wilson
2017-06-05 12:26     ` Michal Hocko
2017-06-05 12:49       ` Chris Wilson
2017-06-05 13:08         ` Michal Hocko
2017-06-05 13:39           ` Chris Wilson
2017-06-06  9:04             ` Michal Hocko
2017-06-05 15:04           ` Chris Wilson
2017-06-06  9:08             ` Michal Hocko
2017-06-08 12:26     ` Michal Hocko
2017-06-08 16:04       ` Chris Wilson
2017-06-01 14:23 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Allow kswapd to pause the device whilst reaping Patchwork
2017-06-02 10:24 ` [PATCH 1/3] " Joonas Lahtinen
2017-06-02 12:02 ` Mika Kuoppala
2017-06-02 12:20   ` Chris Wilson
2017-06-02 12:38     ` Mika Kuoppala
2017-06-02 13:58       ` Chris Wilson [this message]
2017-06-05 11:10 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Allow kswapd to pause the device whilst reaping (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=149641188026.3526.2338712717483204350@mail.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.