From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
smuckle.linux@gmail.com, juri.lelli@arm.com,
Morten.Rasmussen@arm.com, patrick.bellasi@arm.com,
eas-dev@lists.linaro.org
Subject: Re: [RFC 5/9] sched: cpufreq: remove smp_processor_id() in remote paths
Date: Wed, 29 Mar 2017 23:28:12 +0200 [thread overview]
Message-ID: <1836427.bpauTYz19k@aspire.rjw.lan> (raw)
In-Reply-To: <834d098efe029ee687bac7690bb482e9263a766b.1489058244.git.viresh.kumar@linaro.org>
On Thursday, March 09, 2017 05:15:15 PM Viresh Kumar wrote:
> From: Steve Muckle <smuckle.linux@gmail.com>
>
> Upcoming support for remote callbacks from the scheduler into schedutil
> requires that the CPU identified in the hook structure be used to
> indicate the CPU being operated on, rather than relying on
> smp_processor_id().
>
> Note that policy->cpu is passed to trace_cpu_frequency() in fast switch
> path, as it is safe to use any CPU which is managed by the current
> policy.
This should be commented about in the code too IMO.
>
> Signed-off-by: Steve Muckle <smuckle.linux@gmail.com>
> [ vk: updated commit log, minor code cleanups and use policy->cpu for
> traces ]
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> kernel/sched/cpufreq_schedutil.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index a418544c51b1..b168c31f1c8f 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -96,7 +96,7 @@ static void sugov_fast_switch(struct cpufreq_policy *policy,
> return;
>
> policy->cur = next_freq;
> - trace_cpu_frequency(next_freq, smp_processor_id());
> + trace_cpu_frequency(next_freq, policy->cpu);
> }
>
> static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time,
> @@ -106,7 +106,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time,
>
> if (policy->fast_switch_enabled) {
> if (sg_policy->next_freq == next_freq) {
> - trace_cpu_frequency(policy->cur, smp_processor_id());
> + trace_cpu_frequency(policy->cur, policy->cpu);
> return;
> }
> sg_policy->next_freq = next_freq;
> @@ -157,12 +157,12 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
> return cpufreq_driver_resolve_freq(policy, freq);
> }
>
> -static void sugov_get_util(unsigned long *util, unsigned long *max)
> +static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu)
> {
> - struct rq *rq = this_rq();
> + struct rq *rq = cpu_rq(cpu);
> unsigned long cfs_max;
>
> - cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id());
> + cfs_max = arch_scale_cpu_capacity(NULL, cpu);
>
> *util = min(rq->cfs.avg.util_avg, cfs_max);
> *max = cfs_max;
> @@ -216,7 +216,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
> if (flags & SCHED_CPUFREQ_RT_DL) {
> next_f = policy->cpuinfo.max_freq;
> } else {
> - sugov_get_util(&util, &max);
> + sugov_get_util(&util, &max, hook->cpu);
Why is this not racy?
> sugov_iowait_boost(sg_cpu, &util, &max);
> next_f = get_next_freq(sg_policy, util, max);
> }
> @@ -272,7 +272,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,
> unsigned long util, max;
> unsigned int next_f;
>
> - sugov_get_util(&util, &max);
> + sugov_get_util(&util, &max, hook->cpu);
>
And here?
> raw_spin_lock(&sg_policy->update_lock);
>
>
Thanks,
Rafael
next prev parent reply other threads:[~2017-03-29 21:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 11:45 [RFC 0/9] cpufreq: schedutil: Allow remote wakeups Viresh Kumar
2017-03-09 11:45 ` [RFC 1/9] sched: cpufreq: add cpu to update_util_data Viresh Kumar
2017-03-29 21:18 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 2/9] irq_work: add irq_work_queue_on for !CONFIG_SMP Viresh Kumar
2017-03-29 21:20 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 3/9] cpufreq: Add dvfs_possible_from_any_cpu policy flag Viresh Kumar
2017-03-29 21:22 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 4/9] sched: cpufreq: extend irq work to support fast switches Viresh Kumar
2017-03-29 21:25 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 5/9] sched: cpufreq: remove smp_processor_id() in remote paths Viresh Kumar
2017-03-29 21:28 ` Rafael J. Wysocki [this message]
2017-04-11 10:35 ` Viresh Kumar
2017-04-11 14:00 ` Rafael J. Wysocki
2017-04-12 14:26 ` Viresh Kumar
2017-04-12 22:53 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 6/9] sched: cpufreq: detect, process remote callbacks Viresh Kumar
2017-03-29 21:58 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 7/9] cpufreq: governor: support scheduler cpufreq callbacks on remote CPUs Viresh Kumar
2017-03-29 22:14 ` Rafael J. Wysocki
2017-04-11 11:06 ` Viresh Kumar
2017-03-09 11:45 ` [RFC 8/9] intel_pstate: ignore " Viresh Kumar
2017-03-29 22:15 ` Rafael J. Wysocki
2017-03-09 11:45 ` [RFC 9/9] sched: cpufreq: enable remote sched cpufreq callbacks Viresh Kumar
2017-03-15 11:45 ` [RFC 0/9] cpufreq: schedutil: Allow remote wakeups Rafael J. Wysocki
2017-03-16 3:09 ` Viresh Kumar
2017-03-16 10:04 ` Rafael J. Wysocki
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=1836427.bpauTYz19k@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=Morten.Rasmussen@arm.com \
--cc=eas-dev@lists.linaro.org \
--cc=juri.lelli@arm.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=patrick.bellasi@arm.com \
--cc=peterz@infradead.org \
--cc=smuckle.linux@gmail.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