lkml.org 
[lkml]   [2021]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/uclamp: Avoid setting cpu.uclamp.min bigger than cpu.uclamp.max
On 06/03/21 10:24, Xuewen Yan wrote:
> +CC Qais

Thanks for the CC :)

>
>
> Hi Quentin
>
> On Wed, Jun 2, 2021 at 9:22 PM Quentin Perret <qperret@google.com> wrote:
> >
> > +CC Patrick and Tejun
> >
> > On Wednesday 02 Jun 2021 at 20:38:03 (+0800), Xuewen Yan wrote:
> > > From: Xuewen Yan <xuewen.yan@unisoc.com>
> > >
> > > When setting cpu.uclamp.min/max in cgroup, there is no validating
> > > like uclamp_validate() in __sched_setscheduler(). It may cause the
> > > cpu.uclamp.min is bigger than cpu.uclamp.max.
> >
> > ISTR this was intentional. We also allow child groups to ask for
> > whatever clamps they want, but that is always limited by the parent, and
> > reflected in the 'effective' values, as per the cgroup delegation model.

As Quentin said. This intentional to comply with cgroup model.

See Limits and Protections sections in Documentation/admin-guide/cgroup-v2.rst

Specifically

"all configuration combinations are valid"

So user can set cpu.uclamp.min higher than cpu.uclamp.max. But when we apply
the setting, cpu.uclamp.min will be capped by cpu.uclamp.max. I can see you
found the cpu_util_update_eff() logic.

>
> It does not affect the 'effective' value. That because there is
> protection in cpu_util_update_eff():
> /* Ensure protection is always capped by limit */
> eff[UCLAMP_MIN] = min(eff[UCLAMP_MIN], eff[UCLAMP_MAX]);
>
> When users set the cpu.uclamp.min > cpu.uclamp.max:
> cpu.uclamp.max = 50;
> to set : cpu.uclamp.min = 60;
> That would make the uclamp_req[UCLAMP_MIN].value = 1024* 60% = 614,
> uclamp_req[UCLAMP_MAX].value = 1024* 50% = 512;
> But finally, the uclamp[UCLAMP_MIN].value = uclamp[UCLAMP_MAX].value
> = 1024* 50% = 512;
>
> Is it deliberately set not to validate because of the above?

Sorry I'm not following you here. What code paths were you trying to explain
here?

Did you actually hit any problem here?

Thanks

--
Qais Yousef

\
 
 \ /
  Last update: 2021-06-04 18:09    [W:0.081 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site