lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180911164637.GC1413@e110439-lin>
Date:   Tue, 11 Sep 2018 17:46:37 +0100
From:   Patrick Bellasi <patrick.bellasi@....com>
To:     Suren Baghdasaryan <surenb@...gle.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, linux-pm@...r.kernel.org,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Tejun Heo <tj@...nel.org>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Paul Turner <pjt@...gle.com>,
        Quentin Perret <quentin.perret@....com>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Todd Kjos <tkjos@...gle.com>,
        Joel Fernandes <joelaf@...gle.com>,
        Steve Muckle <smuckle@...gle.com>
Subject: Re: [PATCH v4 11/16] sched/core: uclamp: add system default clamps

On 10-Sep 09:20, Suren Baghdasaryan wrote:
> On Tue, Aug 28, 2018 at 6:53 AM, Patrick Bellasi
> <patrick.bellasi@....com> wrote:

[...]

> > @@ -1509,12 +1633,17 @@ static void __init init_uclamp(void)
> >                 uc_se->group_id = UCLAMP_NOT_VALID;
> >                 uclamp_group_get(NULL, clamp_id, 0, uc_se,
> >                                  uclamp_none(clamp_id));
> > +               /*
> > +                * By default we do not want task-specific clamp values,
> > +                * so that system default values apply.
> > +                */
> > +               uc_se->value = UCLAMP_NOT_VALID;
> >
> >  #ifdef CONFIG_UCLAMP_TASK_GROUP
> >                 /* Init root TG's clamp group */
> >                 uc_se = &root_task_group.uclamp[clamp_id];
> >
> > -               uc_se->effective.value = uclamp_none(clamp_id);
> > +               uc_se->effective.value = uclamp_none(UCLAMP_MAX);
> 
> Both clamps are initialized with 1023 because children can go lower
> but can't go higher? Comment might be helpful.

Yes, that's because with CGroups we set the max allowed value, which
is also the one used for a clamp IFF:
 - the task is not part of a more restrictive group
 - the task has not a more restrictive task specific value

I'll improve this comment on the next respin.

> I saw this pattern of using uclamp_none(UCLAMP_MAX) for both clamps in
> couple places.

The other place is to define / initialize "uclamp_default_perf", which
is the default clamps used for RT tasks, introduce by the last patch:

 https://lore.kernel.org/lkml/20180828135324.21976-17-patrick.bellasi@arm.com/

So, RT tasks and root task group are the only two exceptions for
which, by default, we want a maximum boosting.

> Maybe would be better to have smth like:
> 
> static inline int tg_uclamp_none(int clamp_id) {
>     /* TG's min and max clamps default to SCHED_CAPACITY_SCALE to
> allow children to tighten the restriction */
>     return SCHED_CAPACITY_SCALE;
> }
> 
> and use tg_uclamp_none(clamp_id) instead of uclamp_none(UCLAMP_MAX)?
> Functionally the same but much more readable.

Not entirely convinced, maybe because of the name you suggest: it
cannot contain tg, because it applies also to RT tasks when TG are not
in use.

Maybe something like: uclamp_max_boost(clamp_id) could work instead ?

It will make more explicit that the configuration will maps into a:

     util.min = util.max = SCHED_CAPACITY_SCALE

Cheers,
Patrick

-- 
#include <best/regards.h>

Patrick Bellasi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ