public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Encapsulate set custom slice in a __setparam_fair() function
Date: Fri, 10 Jan 2025 17:58:28 +0100	[thread overview]
Message-ID: <20250110165828.GD4213@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250110144656.484601-1-vincent.guittot@linaro.org>

On Fri, Jan 10, 2025 at 03:46:56PM +0100, Vincent Guittot wrote:
> Similarly to dl, create a __setparam_fair() function to set parameters
> related to fair class and move it in the fair.c file.
> 
> No functional changes expected
> 
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>

Thanks!

> @@ -5050,6 +5053,26 @@ static inline void util_est_update(struct cfs_rq *cfs_rq,
>  	trace_sched_util_est_se_tp(&p->se);
>  }
>  
> +void __setparam_fair(struct task_struct *p, const struct sched_attr *attr)
> +{
> +	struct sched_entity *se = &p->se;
> +	unsigned int util_est;
> +
> +	p->static_prio = NICE_TO_PRIO(attr->sched_nice);
> +	if (attr->sched_runtime) {
> +		se->custom_slice = 1;
> +		se->slice = clamp_t(u64, attr->sched_runtime,
> +				      NSEC_PER_MSEC/10,   /* HZ=1000 * 10 */
> +				      NSEC_PER_MSEC*100); /* HZ=100  / 10 */
> +	} else {
> +		se->custom_slice = 0;
> +		se->slice = sysctl_sched_base_slice;
> +	}
> +
> +
> +}
> +
> +

I've trimmed some of that spurious whitespace.

Also, seeing this function, I'm reminded that I used to have that clamp
conditional on !CAP_SYS_NICE -- is that something we want to put in
again?

  parent reply	other threads:[~2025-01-10 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10 14:46 [PATCH] sched/fair: Encapsulate set custom slice in a __setparam_fair() function Vincent Guittot
2025-01-10 15:14 ` Phil Auld
2025-01-10 16:58 ` Peter Zijlstra [this message]
2025-01-10 17:16   ` Vincent Guittot
2025-01-15  9:17 ` [tip: sched/core] " tip-bot2 for Vincent Guittot

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=20250110165828.GD4213@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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