public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>,
	mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, fweisbec@gmail.com,
	tglx@linutronix.de, bristot@redhat.com,
	linux-kernel@vger.kernel.org, joel@joelfernandes.org
Cc: qais.yousef@arm.com, Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [RFC PATCH 5/6] sched/fair: trigger the update of blocked load on newly idle cpu
Date: Tue, 09 Feb 2021 13:09:41 +0000	[thread overview]
Message-ID: <jhjsg65tmju.mognet@arm.com> (raw)
In-Reply-To: <20210205114830.781-6-vincent.guittot@linaro.org>

On 05/02/21 12:48, Vincent Guittot wrote:
> Instead of waking up a random and already idle CPU, we can take advantage
> of this_cpu being about to enter idle to run the ILB and update the
> blocked load.
>
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>  include/linux/sched/nohz.h |  2 ++
>  kernel/sched/fair.c        | 11 ++++++++---
>  kernel/sched/idle.c        |  6 ++++++
>  3 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h
> index 6d67e9a5af6b..74cdc4e87310 100644
> --- a/include/linux/sched/nohz.h
> +++ b/include/linux/sched/nohz.h
> @@ -9,8 +9,10 @@
>  #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
>  extern void nohz_balance_enter_idle(int cpu);
>  extern int get_nohz_timer_target(void);
> +extern void nohz_run_idle_balance(int cpu);
>  #else
>  static inline void nohz_balance_enter_idle(int cpu) { }
> +static inline void nohz_run_idle_balance(int cpu) { }
>  #endif
>
>  #ifdef CONFIG_NO_HZ_COMMON
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 935594cd5430..3d2ab28d5736 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10461,6 +10461,11 @@ static bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle)
>       return true;
>  }
>
> +void nohz_run_idle_balance(int cpu)
> +{
> +	nohz_idle_balance(cpu_rq(cpu), CPU_IDLE);
> +}
> +
>  static void nohz_newidle_balance(struct rq *this_rq)
>  {
>       int this_cpu = this_rq->cpu;
> @@ -10482,10 +10487,10 @@ static void nohz_newidle_balance(struct rq *this_rq)
>               return;
>
>       /*
> -	 * Blocked load of idle CPUs need to be updated.
> -	 * Kick an ILB to update statistics.
> +	 * Set the need to trigger ILB in order to update blocked load
> +	 * before entering idle state.
>        */
> -	kick_ilb(NOHZ_STATS_KICK);
> +	this_rq->nohz_idle_balance = NOHZ_STATS_KICK;
>  }
>
>  #else /* !CONFIG_NO_HZ_COMMON */
> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> index 305727ea0677..52a4e9ce2f9b 100644
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -261,6 +261,12 @@ static void cpuidle_idle_call(void)
>  static void do_idle(void)
>  {
>       int cpu = smp_processor_id();
> +
> +	/*
> +	 * Check if we need to update some blocked load
> +	 */
> +	nohz_run_idle_balance(cpu);
> +

What do we gain from doing this here vs having a stats update in
newidle_balance()?

The current approach is to have a combined load_balance() + blocked load
update during newidle, and I get that this can take too long. But then,
we could still have what you're adding to do_idle() in the tail of
newidle_balance() itself, no? i.e.

  newidle_balance()
    ...
    for_each_domain(this_cpu, sd) {
       ...
       pulled_task = load_balance(...);
       ...
    }
    ...
    if (!pulled_task && !this_rq->nr_running) {
      this_rq->nohz_idle_balance = NOHZ_STATS_KICK;
      _nohz_idle_balance();
    }

or somesuch.

>       /*
>        * If the arch has a polling bit, we maintain an invariant:
>        *
> --
> 2.17.1

  reply	other threads:[~2021-02-09 13:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 11:48 [PATCH 0/6] move update blocked load outside newidle_balance Vincent Guittot
2021-02-05 11:48 ` [PATCH 1/6] sched/fair: remove update of blocked load from newidle_balance Vincent Guittot
2021-02-09 13:09   ` Valentin Schneider
2021-02-09 13:20     ` Vincent Guittot
2021-02-09 13:44   ` Dietmar Eggemann
2021-02-05 11:48 ` [PATCH 2/6] sched/fair: remove unused parameter of update_nohz_stats Vincent Guittot
2021-02-09 13:45   ` Dietmar Eggemann
2021-02-09 17:38     ` Vincent Guittot
2021-02-05 11:48 ` [PATCH 3/6] sched/fair: merge for each idle cpu loop of ILB Vincent Guittot
2021-02-09 13:09   ` Valentin Schneider
2021-02-05 11:48 ` [PATCH 4/6] sched/fair: reorder newidle_balance pulled_task test Vincent Guittot
2021-02-09 13:46   ` Dietmar Eggemann
2021-02-05 11:48 ` [RFC PATCH 5/6] sched/fair: trigger the update of blocked load on newly idle cpu Vincent Guittot
2021-02-09 13:09   ` Valentin Schneider [this message]
2021-02-09 13:57     ` Vincent Guittot
2021-02-09 17:25       ` Valentin Schneider
2021-02-09 13:47   ` Dietmar Eggemann
2021-02-09 14:22     ` Vincent Guittot
2021-02-05 11:48 ` [PATCH 6/6] sched/fair: reduce the window for duplicated update Vincent Guittot
2021-02-05 16:13   ` [PATCH 6/6 v2] " Vincent Guittot

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=jhjsg65tmju.mognet@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=fweisbec@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qais.yousef@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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