[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKfTPtA=H3xooGrJ0o55yfQyv7c0QZucqZ++ebfo4okVKa2Zjg@mail.gmail.com>
Date: Fri, 10 Jan 2025 18:16:35 +0100
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mingo@...hat.com, juri.lelli@...hat.com, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de, vschneid@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched/fair: Encapsulate set custom slice in a
__setparam_fair() function
On Fri, 10 Jan 2025 at 17:58, Peter Zijlstra <peterz@...radead.org> wrote:
>
> 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@...aro.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?
I don't think it's needed as I'm not sure we can handle correctly
slice outside this clamp range anyway
Powered by blists - more mailing lists