From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org, Linux MM <linux-mm@kvack.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Jens Axboe <jens.axboe@oracle.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Christoph Lameter <cl@linux-foundation.org>,
Hugh Dickins <hugh@veritas.com>,
Pekka Enberg <penberg@cs.helsinki.fi>
Subject: Re: [Intel-gfx] [PATCH v2 1/3] drm/i915: Enable lockless lookup of request tracking via RCU
Date: Tue, 5 Jan 2016 15:59:51 +0100 [thread overview]
Message-ID: <20160105145951.GN8076@phenom.ffwll.local> (raw)
In-Reply-To: <1450877756-2902-1-git-send-email-chris@chris-wilson.co.uk>
On Wed, Dec 23, 2015 at 01:35:54PM +0000, Chris Wilson wrote:
> If we enable RCU for the requests (providing a grace period where we can
> inspect a "dead" request before it is freed), we can allow callers to
> carefully perform lockless lookup of an active request.
>
> However, by enabling deferred freeing of requests, we can potentially
> hog a lot of memory when dealing with tens of thousands of requests per
> second - with a quick insertion of the a synchronize_rcu() inside our
> shrinker callback, that issue disappears.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 3 ++-
> drivers/gpu/drm/i915/i915_gem_request.c | 2 +-
> drivers/gpu/drm/i915/i915_gem_request.h | 24 +++++++++++++++++++++++-
> drivers/gpu/drm/i915/i915_gem_shrinker.c | 1 +
> 4 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index c169574758d5..696ada3891ed 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4222,7 +4222,8 @@ i915_gem_load(struct drm_device *dev)
> dev_priv->requests =
> kmem_cache_create("i915_gem_request",
> sizeof(struct drm_i915_gem_request), 0,
> - SLAB_HWCACHE_ALIGN,
> + SLAB_HWCACHE_ALIGN |
> + SLAB_DESTROY_BY_RCU,
> NULL);
>
> INIT_LIST_HEAD(&dev_priv->context_list);
[snip i915 private changes, leave just slab/shrinker changes]
> diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> index c561ed2b8287..03a8bbb3e31e 100644
> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> @@ -142,6 +142,7 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
> }
>
> i915_gem_retire_requests(dev_priv->dev);
> + synchronize_rcu(); /* expedite the grace period to free the requests */
Shouldn't the slab subsystem do this for us if we request it delays the
actual kfree? Seems like a core bug to me ... Adding more folks.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-01-05 14:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 11:19 [PATCH] RFC drm/i915: Remove (struct_mutex) locking for wait-ioctl Chris Wilson
2015-12-23 11:32 ` Chris Wilson
2015-12-23 12:05 ` Chris Wilson
2015-12-23 12:13 ` Chris Wilson
2015-12-23 12:26 ` Chris Wilson
2015-12-23 13:35 ` [PATCH v2 1/3] drm/i915: Enable lockless lookup of request tracking via RCU Chris Wilson
2015-12-23 13:35 ` [PATCH v2 2/3] drm/i915: Remove (struct_mutex) locking for wait-ioctl Chris Wilson
2015-12-23 13:35 ` [PATCH v2 3/3] drm/i915: Remove (struct_mutex) locking for busy-ioctl Chris Wilson
2016-01-05 14:59 ` Daniel Vetter [this message]
2016-01-05 15:02 ` [Intel-gfx] [PATCH v2 1/3] drm/i915: Enable lockless lookup of request tracking via RCU Peter Zijlstra
2016-01-05 15:06 ` Peter Zijlstra
2016-01-05 16:35 ` Paul E. McKenney
2016-01-06 8:06 ` Daniel Vetter
2016-01-06 8:38 ` Peter Zijlstra
2016-01-06 15:56 ` [Intel-gfx] " Paul E. McKenney
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=20160105145951.GN8076@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=a.p.zijlstra@chello.nl \
--cc=chris@chris-wilson.co.uk \
--cc=cl@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jens.axboe@oracle.com \
--cc=linux-mm@kvack.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penberg@cs.helsinki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox