linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Bellasi <patrick.bellasi@arm.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>, Tejun Heo <tj@kernel.org>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Paul Turner <pjt@google.com>,
	Quentin Perret <quentin.perret@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Juri Lelli <juri.lelli@redhat.com>, Todd Kjos <tkjos@google.com>,
	Joel Fernandes <joelaf@google.com>,
	Steve Muckle <smuckle@google.com>,
	Suren Baghdasaryan <surenb@google.com>,
	Alessio Balsini <balsini@android.com>
Subject: Re: [PATCH v11 2/5] sched/core: uclamp: Propagate parent clamps
Date: Tue, 16 Jul 2019 15:07:06 +0100	[thread overview]
Message-ID: <20190716140706.vuggfigjlys44lkp@e110439-lin> (raw)
In-Reply-To: <20190715164200.GA30862@blackbody.suse.cz>

Hi Michal,

On 15-Jul 18:42, Michal Koutný wrote:
> On Mon, Jul 08, 2019 at 09:43:54AM +0100, Patrick Bellasi <patrick.bellasi@arm.com> wrote:
> > Since it's possible for a cpu.uclamp.min value to be bigger than the
> > cpu.uclamp.max value, ensure local consistency by restricting each
> > "protection"
> > (i.e. min utilization) with the corresponding "limit" (i.e. max
> > utilization).
> I think this constraint should be mentioned in the Documentation/....

That note comes from the previous review cycle and it's based on a
request from Tejun to align uclamp behaviors with the way the
delegation model is supposed to work.

I guess this part of the documentation:
   https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html?highlight=protections#resource-distribution-models
should already cover the expected uclamp min/max behaviors.

However, I guess "repetita iuvant" in this case. I'll call this out
explicitly in the description of cpu.uclamp.min.

> > +static void cpu_util_update_eff(struct cgroup_subsys_state *css)
> > +{
> > +	struct cgroup_subsys_state *top_css = css;
> > +	struct uclamp_se *uc_se = NULL;
> > +	unsigned int eff[UCLAMP_CNT];
> > +	unsigned int clamp_id;
> > +	unsigned int clamps;
> > +
> > +	css_for_each_descendant_pre(css, top_css) {
> > +		uc_se = css_tg(css)->parent
> > +			? css_tg(css)->parent->uclamp : NULL;
> > +
> > +		for_each_clamp_id(clamp_id) {
> > +			/* Assume effective clamps matches requested clamps */
> > +			eff[clamp_id] = css_tg(css)->uclamp_req[clamp_id].value;
> > +			/* Cap effective clamps with parent's effective clamps */
> > +			if (uc_se &&
> > +			    eff[clamp_id] > uc_se[clamp_id].value) {
> > +				eff[clamp_id] = uc_se[clamp_id].value;
> > +			}
> > +		}
> > +		/* Ensure protection is always capped by limit */
> > +		eff[UCLAMP_MIN] = min(eff[UCLAMP_MIN], eff[UCLAMP_MAX]);
> > +
> > +		/* Propagate most restrictive effective clamps */
> > +		clamps = 0x0;
> > +		uc_se = css_tg(css)->uclamp;
> (Nitpick only, reassigning child where was parent before decreases
> readibility. IMO)

Did not checked but I think the compiler will figure out it can still
use a single pointer for both assignments.
I'll let's the compiler to its job and add in a dedicated stack var
for the parent pointer.


> > +		for_each_clamp_id(clamp_id) {
> > +			if (eff[clamp_id] == uc_se[clamp_id].value)
> > +				continue;
> > +			uc_se[clamp_id].value = eff[clamp_id];
> > +			uc_se[clamp_id].bucket_id = uclamp_bucket_id(eff[clamp_id]);
> Shouldn't these writes be synchronized with writes from
> __setscheduler_uclamp()?

You right, the synchronization is introduced by a later patch:

   sched/core: uclamp: Update CPU's refcount on TG's clamp changes

Cheers,
Patrick

-- 
#include <best/regards.h>

Patrick Bellasi

  reply	other threads:[~2019-07-16 14:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  8:43 [PATCH v11 0/5] Add utilization clamping support (CGroups API) Patrick Bellasi
2019-07-08  8:43 ` [PATCH v11 1/5] sched/core: uclamp: Extend CPU's cgroup controller Patrick Bellasi
2019-07-08 11:08   ` Quentin Perret
2019-07-15 13:38     ` Patrick Bellasi
2019-07-18 14:52   ` Tejun Heo
2019-07-18 15:26     ` Patrick Bellasi
2019-07-08  8:43 ` [PATCH v11 2/5] sched/core: uclamp: Propagate parent clamps Patrick Bellasi
2019-07-15 16:42   ` Michal Koutný
2019-07-16 14:07     ` Patrick Bellasi [this message]
2019-07-16 15:29       ` Michal Koutný
2019-07-16 17:55         ` Patrick Bellasi
2019-07-08  8:43 ` [PATCH v11 3/5] sched/core: uclamp: Propagate system defaults to root group Patrick Bellasi
2019-07-15 16:42   ` Michal Koutný
2019-07-16 14:34     ` Patrick Bellasi
2019-07-16 15:36       ` Michal Koutný
2019-07-16 18:00         ` Patrick Bellasi
2019-07-16 15:46       ` Joel Fernandes
2019-07-08  8:43 ` [PATCH v11 4/5] sched/core: uclamp: Use TG's clamps to restrict TASK's clamps Patrick Bellasi
2019-07-15 16:42   ` Michal Koutný
2019-07-16 14:34     ` Patrick Bellasi
2019-07-16 15:58       ` Michal Koutný
2019-07-08  8:43 ` [PATCH v11 5/5] sched/core: uclamp: Update CPU's refcount on TG's clamp changes Patrick Bellasi
2019-07-15 16:51 ` [PATCH v11 0/5] Add utilization clamping support (CGroups API) Michal Koutný
2019-07-16 14:03   ` Patrick Bellasi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190716140706.vuggfigjlys44lkp@e110439-lin \
    --to=patrick.bellasi@arm.com \
    --cc=balsini@android.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joelaf@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=quentin.perret@arm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=smuckle@google.com \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --cc=tkjos@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).