public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Suleiman Souhlal <suleiman@google.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	"Paul E . McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH 2/3] sched/nohz: Update comments about NEWILB_KICK
Date: Fri, 20 Oct 2023 09:51:10 +0200	[thread overview]
Message-ID: <ZTIxbrgYHdTMfhVs@gmail.com> (raw)
In-Reply-To: <20231020014031.919742-2-joel@joelfernandes.org>


* Joel Fernandes (Google) <joel@joelfernandes.org> wrote:

> How ILB is triggered without IPIs is cryptic. Out of mercy for future
> code readers, document it in code comments.
> 
> The comments are derived from a discussion with Vincent in a past
> review.
> 
> Cc: Suleiman Souhlal <suleiman@google.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  kernel/sched/fair.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 965c30fbbe5c..8e276d12c3cb 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -11959,8 +11959,19 @@ static bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle)
>  }
>  
>  /*
> - * Check if we need to run the ILB for updating blocked load before entering
> - * idle state.
> + * Check if we need to directly run the ILB for updating blocked load before
> + * entering idle state. Here we run ILB directly without issuing IPIs.
> + *
> + * Note that when this function is called, the tick may not yet be stopped on
> + * this CPU yet. nohz.idle_cpus_mask is updated only when tick is stopped and
> + * cleared on the next busy tick. In other words, nohz.idle_cpus_mask updates
> + * don't align with CPUs enter/exit idle to avoid bottlenecks due to high idle
> + * entry/exit rate (usec). So it is possible that _nohz_idle_balance() is
> + * called from this function on (this) CPU that's not yet in the mask. That's
> + * OK because the goal of nohz_run_idle_balance() is to run ILB only for
> + * updating the blocked load of already idle CPUs without waking up one of
> + * those idle CPUs and outside the preempt disable / irq off phase of the local
> + * cpu about to enter idle, because it can take a long time.

Much appreciated! Feel free to update comments for the entire relevant code 
base, a lot of it has become cryptic and under-documented at best as 
complexity increased ...

Thanks,

	Ingo

  reply	other threads:[~2023-10-20  7:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20  1:40 [PATCH 1/3] sched/nohz: Update nohz.next_balance directly without IPIs (v2) Joel Fernandes (Google)
2023-10-20  1:40 ` [PATCH 2/3] sched/nohz: Update comments about NEWILB_KICK Joel Fernandes (Google)
2023-10-20  7:51   ` Ingo Molnar [this message]
2023-10-20  8:02   ` [tip: sched/core] " tip-bot2 for Joel Fernandes (Google)
2023-10-20  1:40 ` [PATCH 3/3] sched: Update ->next_balance correctly during newidle balance Joel Fernandes (Google)
2023-10-20  7:53   ` Ingo Molnar
2023-10-20 13:48     ` Vincent Guittot
2023-10-21  6:50       ` Ingo Molnar
2023-10-20  8:02   ` [tip: sched/core] sched/fair: " tip-bot2 for Vineeth Pillai (Google)
2023-10-20 13:40   ` [PATCH 3/3] sched: " Vincent Guittot
2023-10-20 13:56     ` Ingo Molnar
2023-10-20 15:50       ` Joel Fernandes
2023-10-22  0:28     ` Joel Fernandes
2023-10-26 14:23       ` Vincent Guittot
2023-11-09 10:02         ` Joel Fernandes
2023-11-09 12:31           ` Joel Fernandes
2023-11-14 15:43           ` Vincent Guittot
2023-11-14 17:43             ` Joel Fernandes
2024-06-13  7:13             ` Joel Fernandes
2025-11-25 13:16               ` [PATCH] sched/fair: Only increment deadline once on yield Wang Tao
2025-11-25 13:27               ` [PATCH 3/3] sched: Update ->next_balance correctly during newidle balance Wang Tao
2023-10-20  4:17 ` [PATCH 1/3] sched/nohz: Update nohz.next_balance directly without IPIs (v2) Joel Fernandes

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=ZTIxbrgYHdTMfhVs@gmail.com \
    --to=mingo@kernel.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=suleiman@google.com \
    --cc=vincent.guittot@linaro.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