Re: [PATCH v7 06/15] sched/core: uclamp: Reset uclamp values on RESET_ON_FORK

From: Patrick Bellasi
Date: Mon Mar 18 2019 - 08:58:53 EST


On 13-Mar 21:52, Peter Zijlstra wrote:
> On Fri, Feb 08, 2019 at 10:05:45AM +0000, Patrick Bellasi wrote:
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 070caa1f72eb..8b282616e9c9 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -1071,7 +1071,7 @@ static void __setscheduler_uclamp(struct task_struct *p,
> > }
> > }
> >
> > -static void uclamp_fork(struct task_struct *p)
> > +static void uclamp_fork(struct task_struct *p, bool reset)
> > {
> > unsigned int clamp_id;
> >
> > @@ -1080,6 +1080,17 @@ static void uclamp_fork(struct task_struct *p)
>
> IIRC there's an early return here if the class doesn't have uclamp
> support, which I think is wrong now. You want the reset irrespective of
> whether the class supports it, no?

Yep, actually... since in this method we are always and only resetting
certain values, it's probably better to just remove the check on class
support and unconditionally do the required ones.

> > for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id)
> > p->uclamp[clamp_id].active = false;
> > +
> > + if (likely(!reset))
> > + return;
> > +
> > + for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) {
> > + unsigned int clamp_value = uclamp_none(clamp_id);
> > +
> > + p->uclamp[clamp_id].user_defined = false;
> > + p->uclamp[clamp_id].value = clamp_value;
> > + p->uclamp[clamp_id].bucket_id = uclamp_bucket_id(clamp_value);
> > + }
> > }
>
>

--
#include <best/regards.h>

Patrick Bellasi