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  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]
Date:   Fri, 15 Mar 2019 13:41:39 +0000
From:   Patrick Bellasi <patrick.bellasi@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        linux-api@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
        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>,
        Suren Baghdasaryan <surenb@...gle.com>
Subject: Re: [PATCH v7 03/15] sched/core: uclamp: Add system default clamps

On 13-Mar 21:10, Peter Zijlstra wrote:
> On Wed, Mar 13, 2019 at 05:09:40PM +0000, Patrick Bellasi wrote:
> 
> > Yes, that should be possible... will look into splitting this out in
> > v8 to have something like:
> > 
> > ---8<---
> > struct uclamp_req {
> > 	/* Clamp value "requested" by a scheduling entity */
> > 	unsigned int value		: bits_per(SCHED_CAPACITY_SCALE);
> > 	unsigned int bucket_id		: bits_per(UCLAMP_BUCKETS);
> > 	unsigned int active		: 1;
> > 	unsigned int user_defined	: 1;
> > }
> > 
> > struct uclamp_eff {
> > 	unsigned int value	        : bits_per(SCHED_CAPACITY_SCALE);
> > 	unsigned int bucket_id	        : bits_per(UCLAMP_BUCKETS);
> > }
> 
> No, have _1_ type. There is no point what so ever to splitting this.
> 
> Also, what's @user_defined about, I don't think I've seen that in the
> parent patch.

That's a flag added by one of the following patches, but with the
change you are suggesting below...

> > struct task_struct {
> >         // ...
> >         #ifdef CONFIG_UCLAMP_TASK
> >                 struct uclamp_req uclamp_req[UCLAMP_CNT];
> >                 struct uclamp_eff uclamp_eff[UCLAMP_CNT];
> 
> 		struct uclamp_se uclamp[UCLAMP_CNT];
> 		struct uclamp_se uclamp_req[UCLAMP_CNT];
> 
> Where the first is the very same introduced in patch #1, and leaving it
> in place avoids having to update the sites already using that (or start
> #1 with the _eff name to avoid having to change things around?).
> 
> >         #endif
> >         // ...
> > }
> > 
> > static inline struct uclamp_eff
> > uclamp_eff_get(struct task_struct *p, unsigned int clamp_id)
> > {
> >         struct uclamp_eff uc_eff = p->uclamp_eff[clamp_id];
> 
> just this ^, these lines seem like a superfluous duplication:
> 
> > 	uc_eff.bucket_id = p->uclamp_req[clamp_id].bucket_id;
> > 	uc_eff.value = p->uclamp_req[clamp_id].value;
> 
> 
> > 	if (unlikely(uc_eff.clamp_value > uclamp_default[clamp_id].value)) {
> > 		uc_eff.clamp_value = uclamp_default[clamp_id].value;
> > 		uc_eff.bucket_id = uclamp_default[clamp_id].bucket_id;
> 
> and:
> 
> 		uc = uclamp_default[clamp_id];

... with things like the above line it becomes quite tricky to exploit
the uclamp_se bitfield to track additional flags.

I'll try to remove the need for the "user_defined" flag, as long as we
have only the "active" you we can still manage to keep it in uclamp_se.

If instead we really need more flags, we will likely have to move them
into a separate bitfield. :/

> 
> > 	}
> > 
> >         return uc_eff;
> > }
> > 
> > static inline void
> > uclamp_eff_set(struct task_struct *p, unsigned int clamp_id)
> > {
> >         p->uclamp_eff[clamp_id] = uclamp_eff_get(p, clamp_id);
> > }
> > ---8<---
> > 
> > Is that what you mean ?
> 
> Getting there :-)

Yeah... let see :)


-- 
#include <best/regards.h>

Patrick Bellasi

Powered by blists - more mailing lists