lkml.org 
[lkml]   [2019]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v11 2/5] sched/core: uclamp: Propagate parent clamps
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/....

> +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)

> + 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()?

>

\
 
 \ /
  Last update: 2019-07-15 18:43    [W:0.136 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site