[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190708110838.4ohd7pqx5ngkzcsu@queper01-lin>
Date: Mon, 8 Jul 2019 12:08:41 +0100
From: Quentin Perret <quentin.perret@....com>
To: Patrick Bellasi <patrick.bellasi@....com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
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>,
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>,
Alessio Balsini <balsini@...roid.com>
Subject: Re: [PATCH v11 1/5] sched/core: uclamp: Extend CPU's cgroup
controller
Hi Patrick,
On Monday 08 Jul 2019 at 09:43:53 (+0100), Patrick Bellasi wrote:
> +static inline int uclamp_scale_from_percent(char *buf, u64 *value)
> +{
> + *value = SCHED_CAPACITY_SCALE;
> +
> + buf = strim(buf);
> + if (strncmp("max", buf, 4)) {
> + s64 percent;
> + int ret;
> +
> + ret = cgroup_parse_float(buf, 2, &percent);
> + if (ret)
> + return ret;
> +
> + percent <<= SCHED_CAPACITY_SHIFT;
> + *value = DIV_ROUND_CLOSEST_ULL(percent, 10000);
> + }
> +
> + return 0;
> +}
> +
> +static inline u64 uclamp_percent_from_scale(u64 value)
> +{
> + return DIV_ROUND_CLOSEST_ULL(value * 10000, SCHED_CAPACITY_SCALE);
> +}
FWIW, I tried the patches and realized these conversions result in a
'funny' behaviour from a user's perspective. Things like this happen:
$ echo 20 > cpu.uclamp.min
$ cat cpu.uclamp.min
20.2
$ echo 20.2 > cpu.uclamp.min
$ cat cpu.uclamp.min
20.21
Having looked at the code, I get why this is happening, but I'm not sure
if a random user will. It's not an issue per se, but it's just a bit
weird.
I guess one way to fix this would be to revert back to having a
1024-scale for the cgroup interface too ... Though I understand Tejun
wanted % for consistency with other things.
So, I'm not sure if this is still up for discussion, but in any case I
wanted to say I support your original idea of using a 1024-scale for the
cgroups interface, since that would solve the 'issue' above and keeps
things consistent with the per-task API too.
Thanks,
Quentin
Powered by blists - more mailing lists