public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/i915: Release the active tracker tree upon idling
Date: Thu, 31 Jan 2019 11:33:18 +0000	[thread overview]
Message-ID: <add92c49-c110-330d-98d1-70bef341b7cd@linux.intel.com> (raw)
In-Reply-To: <20190130205039.20959-2-chris@chris-wilson.co.uk>


On 30/01/2019 20:50, Chris Wilson wrote:
> As soon as we detect that the active tracker is idle and we prepare to
> call the retire callback, release the storage for our tree of
> per-timeline nodes. We expect these to be infrequently usage and quick

s/usage/used/

> to allocate, so there is little benefit in keeping the tree cached and
> we would prefer to return the pages back to the system in a timely
> fashion.
> 
> This also means that when we finalize the struct as a whole, we know as
> the activity tracker must be idle, the tree has already been released.
> Indeed we can reduce i915_active_fini() just the assertions that there
> is nothing to do.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_active.c | 33 +++++++++++++++++++++---------
>   drivers/gpu/drm/i915/i915_active.h |  4 ++++
>   2 files changed, 27 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
> index 91950d778cab..b1fefe98f9a6 100644
> --- a/drivers/gpu/drm/i915/i915_active.c
> +++ b/drivers/gpu/drm/i915/i915_active.c
> @@ -16,12 +16,29 @@ struct active_node {
>   	u64 timeline;
>   };
>   
> +static void
> +__active_park(struct i915_active *ref)
> +{
> +	struct active_node *it, *n;
> +
> +	rbtree_postorder_for_each_entry_safe(it, n, &ref->tree, node) {
> +		GEM_BUG_ON(i915_gem_active_isset(&it->base));
> +		kfree(it);
> +	}
> +	ref->tree = RB_ROOT;
> +}
> +
>   static void
>   __active_retire(struct i915_active *ref)
>   {
>   	GEM_BUG_ON(!ref->count);
> -	if (!--ref->count)
> -		ref->retire(ref);
> +	if (--ref->count)
> +		return;
> +
> +	/* return the unused nodes to our slabcache */
> +	__active_park(ref);
> +
> +	ref->retire(ref);
>   }
>   
>   static void
> @@ -210,18 +227,14 @@ int i915_request_await_active(struct i915_request *rq, struct i915_active *ref)
>   	return 0;
>   }
>   
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
>   void i915_active_fini(struct i915_active *ref)
>   {
> -	struct active_node *it, *n;
> -
>   	GEM_BUG_ON(i915_gem_active_isset(&ref->last));
> -
> -	rbtree_postorder_for_each_entry_safe(it, n, &ref->tree, node) {
> -		GEM_BUG_ON(i915_gem_active_isset(&it->base));
> -		kfree(it);
> -	}
> -	ref->tree = RB_ROOT;
> +	GEM_BUG_ON(!RB_EMPTY_ROOT(&ref->tree));
> +	GEM_BUG_ON(ref->count);
>   }
> +#endif
>   
>   #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
>   #include "selftests/i915_active.c"
> diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
> index 8bd7cf757d1a..6130c6770d10 100644
> --- a/drivers/gpu/drm/i915/i915_active.h
> +++ b/drivers/gpu/drm/i915/i915_active.h
> @@ -57,6 +57,10 @@ i915_active_is_idle(const struct i915_active *ref)
>   	return !ref->count;
>   }
>   
> +#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
>   void i915_active_fini(struct i915_active *ref);
> +#else
> +static inline void i915_active_fini(struct i915_active *ref) { }
> +#endif
>   
>   #endif /* _I915_ACTIVE_H_ */
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-01-31 11:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 20:50 [PATCH 1/3] drm/i915: Generalise GPU activity tracking Chris Wilson
2019-01-30 20:50 ` [PATCH 2/3] drm/i915: Release the active tracker tree upon idling Chris Wilson
2019-01-31 11:33   ` Tvrtko Ursulin [this message]
2019-01-30 20:50 ` [PATCH 3/3] drm/i915: Allocate active tracking nodes from a slabcache Chris Wilson
2019-01-31  9:39   ` kbuild test robot
2019-01-31  9:50   ` kbuild test robot
2019-01-31 11:39   ` Tvrtko Ursulin
2019-01-31 11:41     ` Chris Wilson
2019-01-30 22:56 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Generalise GPU activity tracking Patchwork
2019-01-30 22:58 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-01-30 23:19 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-31  9:06 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-31 11:25 ` [PATCH 1/3] " Tvrtko Ursulin
2019-01-31 11:32   ` Chris Wilson
2019-01-31 11:40     ` Tvrtko Ursulin

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=add92c49-c110-330d-98d1-70bef341b7cd@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