From: Peter Zijlstra <peterz@infradead.org>
To: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, juri.lelli@redhat.com, mtosatti@redhat.com,
nilal@redhat.com, frederic@kernel.org
Subject: Re: [PATCH] sched/core: Bypass arch_scale_freq_tick() on nohz_full CPUs
Date: Mon, 30 Aug 2021 11:31:03 +0200 [thread overview]
Message-ID: <20210830093103.GH4353@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20210827184910.2163948-1-nsaenzju@redhat.com>
On Fri, Aug 27, 2021 at 08:49:10PM +0200, Nicolas Saenz Julienne wrote:
> arch_scale_freq_tick() calculations generally track the increment of
> frequency performance counters in between scheduler ticks to provide
> estimations on how DVFS swayed frequency on that CPU. This information
> eventually allows for more precise scheduling decisions. It's all fine
> and good, but nohz_full CPUs are capable of disabling the tick
> indefinitely and potentially trigger overflows in
> arch_scale_freq_tick()'s calculations once it's eventually re-enabled.
>
> This will happen for both users of this interface: x86 and arm64. And
> it's also relevant that the heuristic on what to do in case of
> operations overflowing varies depending on the implementation. It goes
> from fully disabling frequency invariance scaling on all CPUS, to
> ignoring this is a possibility.
>
> It's arguable that nohz_full CPUs are unlikely to benefit much from this
> feature, since their aim is to allow for uninterrupted execution of a
> single task, effectively getting the scheduler out of the way. Also,
> DVFS itself is also unlikely be used on most nohz_full systems, given
> its effects on latency.
>
> So get around this by not calling arch_scale_freq_tick() on nohz_full
> CPUs.
>
> Note that tick_nohz_full_cpu() relies on a static branch, which avoids
> degrading performance on the rest of systems.
>
> Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
> ---
> kernel/sched/core.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 2fd623b2270d..8c04ec0e073a 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5016,7 +5016,13 @@ void scheduler_tick(void)
> unsigned long thermal_pressure;
> u64 resched_latency;
>
> - arch_scale_freq_tick();
> + /*
> + * nohz_full CPUs are capable of disabling the scheduler tick
> + * indefinitely, potentially overflowing arch_scale_freq_tick()
> + * calculations once it's re-enabled.
> + */
> + if (!tick_nohz_full_cpu(smp_processor_id()))
> + arch_scale_freq_tick();
> sched_clock_tick();
>
> rq_lock(rq, &rf);
Hurmph,.. I'm not too happy with this.. Fundamentally the whole
NOHZ_FULL state should be dynamic, it currently isn't but that's
arguably a bug of the current implementation.
As such the above doesn't really dtrt, since a CPU disabling NOHZ_FULL
will then still suffer all them overflows you mentioned.
Frederic, how should this be done right? Is there a place where upon
entering/exiting NOHZ_FULL we can do fixups?
prev parent reply other threads:[~2021-08-30 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 18:49 [PATCH] sched/core: Bypass arch_scale_freq_tick() on nohz_full CPUs Nicolas Saenz Julienne
2021-08-30 9:31 ` Peter Zijlstra [this message]
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=20210830093103.GH4353@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=mtosatti@redhat.com \
--cc=nilal@redhat.com \
--cc=nsaenzju@redhat.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@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