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: <20180413110848.GR14248@e110439-lin>
Date:   Fri, 13 Apr 2018 12:08:48 +0100
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>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Paul Turner <pjt@...gle.com>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Joel Fernandes <joelaf@...gle.com>,
        Steve Muckle <smuckle@...gle.com>
Subject: Re: [PATCH 1/7] sched/core: uclamp: add CPU clamp groups accounting

On 13-Apr 11:46, Peter Zijlstra wrote:
> On Mon, Apr 09, 2018 at 05:56:09PM +0100, Patrick Bellasi wrote:
> > +static inline void uclamp_cpu_get(struct task_struct *p, int cpu, int clamp_id)
> > +{
> > +	struct uclamp_cpu *uc_cpu = &cpu_rq(cpu)->uclamp[clamp_id];
> > +	int clamp_value;
> > +	int group_id;
> > +
> > +	/* Get task's specific clamp value */
> > +	clamp_value = p->uclamp[clamp_id].value;
> > +	group_id = p->uclamp[clamp_id].group_id;
> > +
> > +	/* No task specific clamp values: nothing to do */
> > +	if (group_id == UCLAMP_NONE)
> > +		return;
> > +
> > +	/* Increment the current group_id */
> 
> That I think qualifies being called a bad comment.

my bad :/

> > +	uc_cpu->group[group_id].tasks += 1;
> > +
> > +	/* Mark task as enqueued for this clamp index */
> > +	p->uclamp_group_id[clamp_id] = group_id;
> 
> Why exactly do we need this? we got group_id from @p in the first place.

The idea is to back-annotate on the task the group in which it has
been refcounted. That allows a much simpler and less racy refcount
decrements at dequeue/migration time.

That's also why we have a single call-back, uclamp_task_update(),
for both enqueue/dequeue. Depending on the check performed by
uclamp_task_affects() we know if we have to get or put the refcounter.

> I suspect this is because when we update p->uclamp[], we don't update
> this active value (when needed), is that worth it?

What you mean by "we don't update this active value"?

> > +	/*
> > +	 * If this is the new max utilization clamp value, then we can update
> > +	 * straight away the CPU clamp value. Otherwise, the current CPU clamp
> > +	 * value is still valid and we are done.
> > +	 */
> > +	if (uc_cpu->value < clamp_value)
> > +		uc_cpu->value = clamp_value;
> > +}

-- 
#include <best/regards.h>

Patrick Bellasi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ