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] [day] [month] [year] [list]
Date:   Thu, 22 Nov 2018 14:20:45 +0000
From:   Patrick Bellasi <patrick.bellasi@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, linux-pm@...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 v5 04/15] sched/core: uclamp: add CPU's clamp groups
 refcounting

On 13-Nov 07:11, Patrick Bellasi wrote:
> On 11-Nov 17:47, Peter Zijlstra wrote:
> > On Mon, Oct 29, 2018 at 06:32:59PM +0000, Patrick Bellasi wrote:

[...]

> > > +		/* Both min and max clamps are MAX aggregated */
> > > +		if (max_value < rq->uclamp.group[clamp_id][group_id].value)
> > > +			max_value = rq->uclamp.group[clamp_id][group_id].value;
> > 
> > 		max_value = max(max_value, rq->uclamp.group[clamp_id][group_id].value);
> 
> Right, I get used to this pattern to avoid write instructions.
> I guess that here, being just a function local variable, we don't
> really care much...

The above does not work also because we now use bitfields:

In file included from ./include/linux/list.h:9:0,
                 from ./include/linux/rculist.h:10,
                 from ./include/linux/pid.h:5,
                 from ./include/linux/sched.h:14,
                 from kernel/sched/sched.h:5,
                 from kernel/sched/core.c:8:
   kernel/sched/core.c: In function ‘uclamp_cpu_update’:
   kernel/sched/core.c:867:5: error: ‘typeof’ applied to a bit-field
           rq->uclamp.group[clamp_id][group_id].value);
           ^

[...]

> > > +	if (rq->uclamp.value[clamp_id] < p->uclamp[clamp_id].value)
> > > +		rq->uclamp.value[clamp_id] = p->uclamp[clamp_id].value;
> > 
> > 	rq->uclamp.value[clamp_id] = max(rq->uclamp.value[clamp_id],
> > 					 p->uclamp[clamp_id].value);
> 
> In this case instead, since we are updating a variable visible from
> other CPUs, should not be preferred to avoid assignment when not
> required ?

And what about this ?

> Is the compiler is smart enough to optimize the code above?
> ... will check better.

Did not really checked what the compiler does in the two cases but,
given also the above, for consistency I would probably prefer to keep
both max aggregation as originally defined.

What do you think ?

-- 
#include <best/regards.h>

Patrick Bellasi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ