From: Vincent Guittot <vincent.guittot@linaro.org>
To: Valentin Schneider <vschneid@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 6/9] sched/balancing: Update run_rebalance_domains() comments
Date: Wed, 6 Mar 2024 17:17:28 +0100 [thread overview]
Message-ID: <CAKfTPtCNnTVFdf85sRdJxPhdNZxc8qKcnHL3sznjg-KBVn8Bew@mail.gmail.com> (raw)
In-Reply-To: <xhsmhbk7tdkac.mognet@vschneid-thinkpadt14sgen2i.remote.csb>
On Tue, 5 Mar 2024 at 11:50, Valentin Schneider <vschneid@redhat.com> wrote:
>
> On 04/03/24 10:48, Ingo Molnar wrote:
> > The first sentence of the comment explaining run_rebalance_domains()
> > is historic and not true anymore:
> >
> > * run_rebalance_domains is triggered when needed from the scheduler tick.
> >
> > ... contradicted/modified by the second sentence:
> >
> > * Also triggered for NOHZ idle balancing (with NOHZ_BALANCE_KICK set).
> >
> > Avoid that kind of confusion straight away and explain from what
> > places sched_balance_softirq() is triggered.
> >
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Vincent Guittot <vincent.guittot@linaro.org>
> > Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Valentin Schneider <vschneid@redhat.com>
> > ---
> > kernel/sched/fair.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 4c46bffb6a7a..18b7d2999cff 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -12409,8 +12409,13 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf)
> > }
> >
> > /*
> > - * run_rebalance_domains is triggered when needed from the scheduler tick.
> > - * Also triggered for NOHZ idle balancing (with NOHZ_BALANCE_KICK set).
> > + * The run_rebalance_domains() softirq handler is triggered via SCHED_SOFTIRQ
> > + * from two places:
> > + *
> > + * - the scheduler_tick(),
> > + *
> > + * - from the SMP cross-call function nohz_csd_func(),
> > + * used by NOHZ idle balancing (with NOHZ_BALANCE_KICK set).
>
> Bit of a nit but the CSD is also triggered via the scheduler_tick():
>
> scheduler_tick()
> `\
> trigger_load_balance()
> `\
> raise_softirq(SCHED_SOFTIRQ)
>
> scheduler_tick()
> `\
> trigger_load_balance()
> `\
> nohz_balance_kick()
> `\
> kick_ilb()
> `\
> smp_call_function_single_async(ilb_cpu, &cpu_rq(ilb_cpu)->nohz_csd);
>
> I got to the below which is still somewhat confusing, thoughts?
>
> """
> The run_rebalance_domains() softirq handler is triggered via SCHED_SOFTIRQ
> from two places:
>
> - directly from trigger_load_balance() in scheduler_tick(), for periodic
> load balance
>
> - indirectly from kick_ilb() (invoked down the scheduler_tick() too), which
> issues an SMP cross-call to nohz_csd_func() which will itself raise the
> softirq, for NOHZ idle balancing.
I'm not sure that we should provide too many details of the path as
this might change in the future. What about the below ?
- directly from the local scheduler_tick() for periodic load balance
- indirectly from a remote scheduler_tick() for NOHZ idle balancing
through the SMP cross-call nohz_csd_func()
> """
>
> > */
> > static __latent_entropy void run_rebalance_domains(struct softirq_action *h)
> > {
> > --
> > 2.40.1
>
next prev parent reply other threads:[~2024-03-06 16:17 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 9:48 [PATCH -v3 0/9] sched/balancing: Misc updates & cleanups Ingo Molnar
2024-03-04 9:48 ` [PATCH 1/9] sched/balancing: Switch the 'DEFINE_SPINLOCK(balancing)' spinlock into an 'atomic_t sched_balance_running' flag Ingo Molnar
2024-03-05 10:50 ` Valentin Schneider
2024-03-08 9:48 ` Ingo Molnar
2024-03-05 11:11 ` Shrikanth Hegde
2024-03-08 11:23 ` Ingo Molnar
2024-03-08 14:48 ` Shrikanth Hegde
2024-03-12 10:57 ` Ingo Molnar
2024-03-21 12:12 ` Shrikanth Hegde
2024-03-04 9:48 ` [PATCH 2/9] sched/balancing: Remove reliance on 'enum cpu_idle_type' ordering when iterating [CPU_MAX_IDLE_TYPES] arrays in show_schedstat() Ingo Molnar
2024-03-04 15:05 ` Shrikanth Hegde
2024-03-08 9:55 ` Ingo Molnar
2024-03-04 9:48 ` [PATCH 3/9] sched/balancing: Change 'enum cpu_idle_type' to have more natural definitions Ingo Molnar
2024-03-05 10:50 ` Valentin Schneider
2024-03-06 15:46 ` Vincent Guittot
2024-03-08 9:59 ` Ingo Molnar
2024-03-04 9:48 ` [PATCH 4/9] sched/balancing: Change comment formatting to not overlap Git conflict marker lines Ingo Molnar
2024-03-05 10:50 ` Valentin Schneider
2024-03-06 15:44 ` Vincent Guittot
2024-03-04 9:48 ` [PATCH 5/9] sched/balancing: Fix comments (trying to) refer to NOHZ_BALANCE_KICK Ingo Molnar
2024-03-05 10:50 ` Valentin Schneider
2024-03-06 15:43 ` Vincent Guittot
2024-03-08 10:11 ` Ingo Molnar
2024-03-04 9:48 ` [PATCH 6/9] sched/balancing: Update run_rebalance_domains() comments Ingo Molnar
2024-03-05 10:50 ` Valentin Schneider
2024-03-06 16:17 ` Vincent Guittot [this message]
2024-03-08 10:15 ` Ingo Molnar
2024-03-08 11:57 ` Vincent Guittot
2024-03-08 16:45 ` Valentin Schneider
2024-03-04 9:48 ` [PATCH 7/9] sched/balancing: Vertically align the comments of 'struct sg_lb_stats' and 'struct sd_lb_stats' Ingo Molnar
2024-03-05 10:50 ` Valentin Schneider
2024-03-04 9:48 ` [PATCH 8/9] sched/balancing: Update comments in " Ingo Molnar
2024-03-05 10:51 ` Valentin Schneider
2024-03-04 9:48 ` [PATCH 9/9] sched/balancing: Rename run_rebalance_domains() => sched_balance_softirq() Ingo Molnar
2024-03-05 10:51 ` Valentin Schneider
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=CAKfTPtCNnTVFdf85sRdJxPhdNZxc8qKcnHL3sznjg-KBVn8Bew@mail.gmail.com \
--to=vincent.guittot@linaro.org \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sshegde@linux.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=vschneid@redhat.com \
/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).