Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/1] drm/i915: Inherit submitter nice when scheduling requests
Date: Fri, 8 Apr 2022 09:58:23 +0200	[thread overview]
Message-ID: <Yk/rHyGrOlrkDtdR@phenom.ffwll.local> (raw)
In-Reply-To: <20220407151627.3387655-2-tvrtko.ursulin@linux.intel.com>

On Thu, Apr 07, 2022 at 04:16:27PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Inherit submitter nice at point of request submission to account for long
> running processes getting either externally or self re-niced.
> 
> This accounts for the current processing landscape where computational
> pipelines are composed of CPU and GPU parts working in tandem.
> 
> Nice value will only apply to requests which originate from user contexts
> and have default context priority. This is to avoid disturbing any
> application made choices of low and high (batch processing and latency
> sensitive compositing). In this case nice value adjusts the effective
> priority in the narrow band of -19 to +20 around
> I915_CONTEXT_DEFAULT_PRIORITY.
> 
> This means that userspace using the context priority uapi directly has a
> wider range of possible adjustments (in practice that only applies to
> execlists platforms - with GuC there are only three priority buckets), but
> in all cases nice adjustment has the expected effect: positive nice
> lowering the scheduling priority and negative nice raising it.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

I don't think adding any more fancy features to i915-scheduler makes
sense, at least not before we've cut over to drm/sched.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_request.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index 582770360ad1..e5cfa073d8f0 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -1811,8 +1811,17 @@ void i915_request_add(struct i915_request *rq)
>  	/* XXX placeholder for selftests */
>  	rcu_read_lock();
>  	ctx = rcu_dereference(rq->context->gem_context);
> -	if (ctx)
> +	if (ctx) {
>  		attr = ctx->sched;
> +		/*
> +		 * Inherit process nice when scheduling user contexts but only
> +		 * if context has the default priority to avoid touching
> +		 * contexts where GEM uapi has been used to explicitly lower
> +		 * or elevate it.
> +		 */
> +		if (attr.priority == I915_CONTEXT_DEFAULT_PRIORITY)
> +			attr.priority = -task_nice(current);
> +	}
>  	rcu_read_unlock();
>  
>  	__i915_request_queue(rq, &attr);
> -- 
> 2.32.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2022-04-08  7:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 15:16 [Intel-gfx] [PATCH 0/1] Inherit GPU scheduling priority from process nice Tvrtko Ursulin
2022-04-07 15:16 ` [Intel-gfx] [PATCH 1/1] drm/i915: Inherit submitter nice when scheduling requests Tvrtko Ursulin
2022-04-08  7:58   ` Daniel Vetter [this message]
2022-04-08  8:25     ` Tvrtko Ursulin
2022-04-08  9:50       ` Dave Airlie
2022-04-08 10:29         ` Tvrtko Ursulin
2022-04-08 15:10           ` Daniel Vetter
2022-04-25 11:54             ` Tvrtko Ursulin
2022-04-07 18:05 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for Inherit GPU scheduling priority from process nice (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-04-07 15:28 [Intel-gfx] [PATCH 0/1] Inherit GPU scheduling priority from process nice Tvrtko Ursulin
2022-04-07 15:28 ` [Intel-gfx] [PATCH 1/1] drm/i915: Inherit submitter nice when scheduling requests 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=Yk/rHyGrOlrkDtdR@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tvrtko.ursulin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox