mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Valentin Schneider <valentin.schneider@arm.com>,
	linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [PATCH v2 2/2] sched/fair: Trigger nohz.next_balance updates when a CPU goes NOHZ-idle
Date: Mon, 19 Jul 2021 17:24:46 +0200	[thread overview]
Message-ID: <e8dffbaf-71cb-d3b3-04e8-64fc8e6256af@arm.com> (raw)
In-Reply-To: <20210719103117.3624936-3-valentin.schneider@arm.com>

On 19/07/2021 12:31, Valentin Schneider wrote:

[...]

> @@ -10351,6 +10352,9 @@ static void nohz_balancer_kick(struct rq *rq)
>  unlock:
>  	rcu_read_unlock();
>  out:
> +	if (READ_ONCE(nohz.needs_update))
> +		flags |= NOHZ_NEXT_KICK;
> +

Since NOHZ_NEXT_KICK is part of NOHZ_KICK_MASK, some conditions above
will already set it in flags. Is this intended?

>  	if (flags)
>  		kick_ilb(flags);
>  }
> @@ -10447,12 +10451,13 @@ void nohz_balance_enter_idle(int cpu)
>  	/*
>  	 * Ensures that if nohz_idle_balance() fails to observe our
>  	 * @idle_cpus_mask store, it must observe the @has_blocked
> -	 * store.
> +	 * and @needs_update stores.
>  	 */
>  	smp_mb__after_atomic();
>  
>  	set_cpu_sd_state_idle(cpu);
>  
> +	WRITE_ONCE(nohz.needs_update, 1);
>  out:
>  	/*
>  	 * Each time a cpu enter idle, we assume that it has blocked load and
> @@ -10501,13 +10506,17 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags,

function header would need update to incorporate the new 'update
nohz.next_balance' functionality. It only talks about 'update of blocked
load' and 'complete load balance' so far.

>  	/*
>  	 * We assume there will be no idle load after this update and clear
>  	 * the has_blocked flag. If a cpu enters idle in the mean time, it will
> -	 * set the has_blocked flag and trig another update of idle load.
> +	 * set the has_blocked flag and trigger another update of idle load.
>  	 * Because a cpu that becomes idle, is added to idle_cpus_mask before
>  	 * setting the flag, we are sure to not clear the state and not
>  	 * check the load of an idle cpu.
> +	 *
> +	 * Same applies to idle_cpus_mask vs needs_update.
>  	 */
>  	if (flags & NOHZ_STATS_KICK)
>  		WRITE_ONCE(nohz.has_blocked, 0);
> +	if (flags & NOHZ_NEXT_KICK)
> +		WRITE_ONCE(nohz.needs_update, 0);
>  
>  	/*
>  	 * Ensures that if we miss the CPU, we must see the has_blocked
> @@ -10531,6 +10540,8 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags,
>  		if (need_resched()) {
>  			if (flags & NOHZ_STATS_KICK)
>  				has_blocked_load = true;

This looks weird now? 'has_blocked_load = true' vs
'WRITE_ONCE(nohz.needs_update, 1)'.

> +			if (flags & NOHZ_NEXT_KICK)
> +				WRITE_ONCE(nohz.needs_update, 1);
>  			goto abort;
>  		}
>  
> 


  reply	other threads:[~2021-07-19 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 10:31 [PATCH v2 0/2] sched/fair: nohz.next_balance vs newly-idle CPUs Valentin Schneider
2021-07-19 10:31 ` [PATCH v2 1/2] sched/fair: Add NOHZ balancer flag for nohz.next_balance updates Valentin Schneider
2021-08-10 13:33   ` Vincent Guittot
2021-07-19 10:31 ` [PATCH v2 2/2] sched/fair: Trigger nohz.next_balance updates when a CPU goes NOHZ-idle Valentin Schneider
2021-07-19 15:24   ` Dietmar Eggemann [this message]
2021-07-19 16:28     ` Valentin Schneider
2021-07-20 10:47       ` Dietmar Eggemann

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=e8dffbaf-71cb-d3b3-04e8-64fc8e6256af@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --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

Powered by JetHome