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: <20190507111347.4ivnjwbymsf7i3e6@e110439-lin>
Date:   Tue, 7 May 2019 12:13:47 +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,
        linux-api@...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>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Viresh Kumar <viresh.kumar@...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 v8 06/16] sched/core: uclamp: Extend sched_setattr() to
 support utilization clamping

On 17-Apr 15:26, Suren Baghdasaryan wrote:
> On Tue, Apr 2, 2019 at 3:42 AM Patrick Bellasi <patrick.bellasi@....com> wrote:

[...]

> > Do not allow to change sched class specific params and non class
> > specific params (i.e. clamp values) at the same time.  This keeps things
> > simple and still works for the most common cases since we are usually
> > interested in just one of the two actions.
> 
> Sorry, I can't find where you are checking to eliminate the
> possibility of simultaneous changes to both sched class specific
> params and non class specific params... Am I too tired or they are
> indeed missing?

No, you right... that limitation has been removed in v8 :)

I'll remove the above paragraph in v9, thanks for spotting it.

[...]

> > +static int uclamp_validate(struct task_struct *p,
> > +                          const struct sched_attr *attr)
> > +{
> > +       unsigned int lower_bound = p->uclamp_req[UCLAMP_MIN].value;
> > +       unsigned int upper_bound = p->uclamp_req[UCLAMP_MAX].value;
> > +
> > +       if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN)
> > +               lower_bound = attr->sched_util_min;
> > +       if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX)
> > +               upper_bound = attr->sched_util_max;
> > +
> > +       if (lower_bound > upper_bound)
> > +               return -EINVAL;
> > +       if (upper_bound > SCHED_CAPACITY_SCALE)
> > +               return -EINVAL;
> > +
> > +       return 0;
> > +}

[...]

> >  static void uclamp_fork(struct task_struct *p)
> >  {
> >         unsigned int clamp_id;
> > @@ -1056,6 +1100,13 @@ static void __init init_uclamp(void)
> >  #else /* CONFIG_UCLAMP_TASK */
> >  static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { }
> >  static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { }
> > +static inline int uclamp_validate(struct task_struct *p,
> > +                                 const struct sched_attr *attr)
> > +{
> > +       return -ENODEV;
> 
> ENOSYS might be more appropriate?

Yep, agree, thanks!

> 
> > +}
> > +static void __setscheduler_uclamp(struct task_struct *p,
> > +                                 const struct sched_attr *attr) { }
> >  static inline void uclamp_fork(struct task_struct *p) { }
> >  static inline void init_uclamp(void) { }
> >  #endif /* CONFIG_UCLAMP_TASK */
> > @@ -4424,6 +4475,13 @@ static void __setscheduler_params(struct task_struct *p,
> >  static void __setscheduler(struct rq *rq, struct task_struct *p,
> >                            const struct sched_attr *attr, bool keep_boost)
> >  {
> > +       /*
> > +        * If params can't change scheduling class changes aren't allowed
> > +        * either.
> > +        */
> > +       if (attr->sched_flags & SCHED_FLAG_KEEP_PARAMS)
> > +               return;
> > +
> >         __setscheduler_params(p, attr);
> >
> >         /*
> > @@ -4561,6 +4619,13 @@ static int __sched_setscheduler(struct task_struct *p,
> >                         return retval;
> >         }
> >
> > +       /* Update task specific "requested" clamps */
> > +       if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) {
> > +               retval = uclamp_validate(p, attr);
> > +               if (retval)
> > +                       return retval;
> > +       }
> > +
> >         /*
> >          * Make sure no PI-waiters arrive (or leave) while we are
> >          * changing the priority of the task:

[...]

-- 
#include <best/regards.h>

Patrick Bellasi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ