From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 23/24] drm/i915: Keep a recent cache of freed contexts objects for reuse
Date: Fri, 19 May 2017 10:09:05 +0100 [thread overview]
Message-ID: <fdc24efd-9be0-25f0-f88c-d78f75fc567d@linux.intel.com> (raw)
In-Reply-To: <20170518141946.GG26693@nuc-i3427.alporthouse.com>
On 18/05/2017 15:19, Chris Wilson wrote:
> On Thu, May 18, 2017 at 02:52:41PM +0100, Tvrtko Ursulin wrote:
>>
>> On 18/05/2017 10:46, Chris Wilson wrote:
>>> Keep the recently freed context objects for reuse. This allows us to use
>>> the current GGTT bindings and dma bound pages, avoiding any clflushes as
>>> required. We mark the objects as purgeable under memory pressure, and
>>> reap the list of freed objects as soon as the device is idle.
>>
>> Some description on when is this interesting and by how much?
>
> No interesting workload (a few synthetic benchmarks including the GL).
> Best argument would be a minor improvement in application startup.
In this case I would be reluctant to complicate the code for no benefit.
>> Since you drop everything on idle it must be for some workload which
>> likes to go through context while keeping busy?
>
> Yup, it's just the rule of thumb I have (from experience with the
> cmdparser batch caching).
>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> ---
>>> drivers/gpu/drm/i915/i915_drv.h | 2 +
>>> drivers/gpu/drm/i915/i915_gem.c | 1 +
>>> drivers/gpu/drm/i915/i915_gem_context.c | 59 ++++++++++++++++++++++--
>>> drivers/gpu/drm/i915/i915_gem_context.h | 5 ++
>>> drivers/gpu/drm/i915/intel_lrc.c | 2 +-
>>> drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +-
>>> drivers/gpu/drm/i915/selftests/mock_context.c | 1 +
>>> drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 +
>>> 8 files changed, 68 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>>> index 1d55bbde68df..1fa1e7d48f02 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.h
>>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>>> @@ -2316,6 +2316,8 @@ struct drm_i915_private {
>>> struct llist_head free_list;
>>> struct work_struct free_work;
>>>
>>> + struct list_head freed_objects;
>>
>> free_ctx_objects maybe?
>
> This is i915->contexts.freed_objects (new contexts substruct). There is
> already a precedent for using freed_ (mainly because I think its a
> better description for that phase, free is too similar to avail,
> although you may persuade me that free is better).
My bad, I thought it is drm_i915_private.
>> Knowing you I am surprised this is not bucketed! :)
>
> I didn't bother since we only really have two sizes - also reason why I
> didn't make it per-engine so that we could share the xcs context
> objects. My expectation is that we won't be caught up in slow list
> searches, so went for simplicity for a change.
>
>>> +struct drm_i915_gem_object *
>>> +i915_gem_context_create_object(struct drm_i915_private *i915,
>>> + unsigned long size)
>>> +{
>>> + struct drm_i915_gem_object *obj, *on;
>>> +
>>> + lockdep_assert_held(&i915->drm.struct_mutex);
>>> +
>>> + list_for_each_entry_safe(obj, on,
>>> + &i915->contexts.freed_objects,
>>> + batch_pool_link) {
>>> + if (obj->mm.madv != I915_MADV_DONTNEED) {
>>> + /* Purge the heretic! */
>>
>> I don't see this can happen in the current version?
>
> The power of the shrinker. Remember it can and will stab you in the back
> at any time.
Ok I forgot about the purged state, I just was surprised that anyone
would be able to move the state away from don't need.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-05-19 9:09 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 9:46 [PATCH 01/24] drm/i915/selftests: Pretend to be a gfx pci device Chris Wilson
2017-05-18 9:46 ` [PATCH 02/24] drm/i915: Mark CPU cache as dirty on every transition for CPU writes Chris Wilson
2017-05-18 9:46 ` [PATCH 03/24] drm/i915: Store i915_gem_object_is_coherent() as a bit next to cache-dirty Chris Wilson
2017-05-19 10:22 ` Chris Wilson
2017-05-22 20:39 ` Dongwon Kim
2017-05-18 9:46 ` [PATCH 04/24] drm/i915: Reinstate reservation_object zapping for batch_pool objects Chris Wilson
2017-05-18 9:46 ` [PATCH 05/24] drm/i915: Amalgamate execbuffer parameter structures Chris Wilson
2017-05-18 9:46 ` [PATCH 06/24] drm/i915: Use vma->exec_entry as our double-entry placeholder Chris Wilson
2017-05-18 9:46 ` [PATCH 07/24] drm/i915: Split vma exec_link/evict_link Chris Wilson
2017-05-18 9:46 ` [PATCH 08/24] drm/i915: Store a direct lookup from object handle to vma Chris Wilson
2017-05-18 9:46 ` [PATCH 09/24] drm/i915: Pass vma to relocate entry Chris Wilson
2017-05-18 9:46 ` [PATCH 10/24] drm/i915: Disable EXEC_OBJECT_ASYNC when doing relocations Chris Wilson
2017-05-19 9:05 ` Joonas Lahtinen
2017-05-18 9:46 ` [PATCH 11/24] drm/i915: Eliminate lots of iterations over the execobjects array Chris Wilson
2017-05-18 9:46 ` [PATCH 12/24] drm/i915: Store a persistent reference for an object in the execbuffer cache Chris Wilson
2017-05-19 9:37 ` Joonas Lahtinen
2017-05-18 9:46 ` [PATCH 13/24] drm/i915: First try the previous execbuffer location Chris Wilson
2017-05-18 9:46 ` [PATCH 14/24] drm/i915: Wait upon userptr get-user-pages within execbuffer Chris Wilson
2017-05-18 9:46 ` [PATCH 15/24] drm/i915: Allow execbuffer to use the first object as the batch Chris Wilson
2017-05-18 9:46 ` [PATCH 16/24] drm/i915: Async GPU relocation processing Chris Wilson
2017-05-18 9:46 ` [PATCH 17/24] drm/i915: Stash a pointer to the obj's resv in the vma Chris Wilson
2017-05-19 9:19 ` Joonas Lahtinen
2017-05-18 9:46 ` [PATCH 18/24] drm/i915: Convert execbuf to use struct-of-array packing for critical fields Chris Wilson
2017-05-19 9:25 ` Chris Wilson
2017-05-18 9:46 ` [PATCH 19/24] drm/i915/scheduler: Support user-defined priorities Chris Wilson
2017-08-02 21:55 ` Jason Ekstrand
2017-05-18 9:46 ` [PATCH 20/24] drm/i915: Group all the global context information together Chris Wilson
2017-05-19 9:35 ` Joonas Lahtinen
2017-05-18 9:46 ` [PATCH 21/24] drm/i915: Allow contexts to be unreferenced locklessly Chris Wilson
2017-05-18 9:46 ` [PATCH 22/24] drm/i915: Enable rcu-only context lookups Chris Wilson
2017-05-19 10:36 ` Joonas Lahtinen
2017-05-18 9:46 ` [PATCH 23/24] drm/i915: Keep a recent cache of freed contexts objects for reuse Chris Wilson
2017-05-18 13:52 ` Tvrtko Ursulin
2017-05-18 14:19 ` Chris Wilson
2017-05-19 9:09 ` Tvrtko Ursulin [this message]
2017-05-22 10:51 ` Tvrtko Ursulin
2017-05-22 11:06 ` Chris Wilson
2017-05-18 9:46 ` [PATCH 24/24] RFC drm/i915: Expose a PMU interface for perf queries Chris Wilson
2017-05-18 23:48 ` Dmitry Rogozhkin
2017-05-19 8:01 ` Chris Wilson
2017-05-19 14:54 ` Dmitry Rogozhkin
2017-06-15 11:17 ` Tvrtko Ursulin
2017-05-18 12:31 ` ✓ Fi.CI.BAT: success for series starting with [01/24] drm/i915/selftests: Pretend to be a gfx pci device Patchwork
2017-05-18 13:35 ` [PATCH 01/24] " Tvrtko Ursulin
2017-05-18 14:46 ` Chris Wilson
2017-05-19 9:02 ` Joonas Lahtinen
2017-05-19 9:10 ` Chris Wilson
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=fdc24efd-9be0-25f0-f88c-d78f75fc567d@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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