mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org,
	dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com,
	fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com
Subject: Re: [PATCH tip/core/rcu 3/7] rcu: Avoid IPIing idle CPUs from synchronize_sched_expedited()
Date: Wed, 29 Oct 2014 11:59:54 +0100	[thread overview]
Message-ID: <20141029105954.GZ3337@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1414534982-29203-3-git-send-email-paulmck@linux.vnet.ibm.com>

On Tue, Oct 28, 2014 at 03:22:58PM -0700, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> 
> Currently, synchronize_sched_expedited() sends IPIs to all online CPUs,
> even those that are idle or executing in nohz_full= userspace.  Because
> idle CPUs and nohz_full= userspace CPUs are in extended quiescent states,
> there is no need to IPI them in the first place.  This commit therefore
> avoids IPIing CPUs that are already in extended quiescent states.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  kernel/rcu/tree.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 7f73c5edf8cf..9e3c20f117cd 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2950,6 +2950,9 @@ static int synchronize_sched_expedited_cpu_stop(void *data)
>   */
>  void synchronize_sched_expedited(void)
>  {
> +	cpumask_var_t cm;
> +	bool cma = false;
> +	int cpu;
>  	long firstsnap, s, snap;
>  	int trycount = 0;
>  	struct rcu_state *rsp = &rcu_sched_state;
> @@ -2984,11 +2987,26 @@ void synchronize_sched_expedited(void)
>  	}
>  	WARN_ON_ONCE(cpu_is_offline(raw_smp_processor_id()));
>  
> +	/* Offline CPUs, idle CPUs, and any CPU we run on are quiescent. */
> +	cma = zalloc_cpumask_var(&cm, GFP_KERNEL);
> +	if (cma) {
> +		cpumask_copy(cm, cpu_online_mask);
> +		cpumask_clear_cpu(raw_smp_processor_id(), cm);
> +		for_each_cpu(cpu, cm) {
> +			struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu);
> +
> +			if (!(atomic_add_return(0, &rdtp->dynticks) & 0x1))
> +				cpumask_clear_cpu(cpu, cm);
> +		}
> +		if (cpumask_weight(cm) == 0)
> +			goto all_cpus_idle;
> +	}

Is there a reason not to use on_each_cpu_cond()?

  reply	other threads:[~2014-10-29 11:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 22:22 [PATCH tip/core/rcu 0/7] Real-time updates for 3.19 Paul E. McKenney
2014-10-28 22:22 ` [PATCH tip/core/rcu 1/7] init/Kconfig: move RCU_NOCB_CPU dependencies to choice Paul E. McKenney
2014-10-28 22:22   ` [PATCH tip/core/rcu 2/7] rcu: Move RCU_BOOST variable declarations, eliminating #ifdef Paul E. McKenney
2014-10-28 22:22   ` [PATCH tip/core/rcu 3/7] rcu: Avoid IPIing idle CPUs from synchronize_sched_expedited() Paul E. McKenney
2014-10-29 10:59     ` Peter Zijlstra [this message]
2014-10-29 15:56       ` Paul E. McKenney
2014-10-28 22:22   ` [PATCH tip/core/rcu 4/7] rcu: Unify boost and kthread priorities Paul E. McKenney
2014-10-29 11:01     ` Peter Zijlstra
2014-10-29 16:16       ` Paul E. McKenney
2014-10-31 16:22         ` Peter Zijlstra
2014-10-31 16:42           ` Paul E. McKenney
2014-10-31 16:51             ` Peter Zijlstra
2014-10-31 16:57               ` Paul E. McKenney
2014-10-28 22:23   ` [PATCH tip/core/rcu 5/7] rcu: Remove redundant TREE_PREEMPT_RCU config option Paul E. McKenney
2014-10-28 22:23   ` [PATCH tip/core/rcu 6/7] rcu: Kick rcuo kthreads after their CPU goes offline Paul E. McKenney
2014-10-28 22:23   ` [PATCH tip/core/rcu 7/7] rcu: Fix for rcuo online-time-creation reorganization bug Paul E. McKenney

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=20141029105954.GZ3337@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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