mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Anton Blanchard <anton@au1.ibm.com>,
	Tim Pepper <lnxninja@linux.vnet.ibm.com>
Subject: [RFC PATCH 06/15] nohz_task: Keep the tick if rcu needs it
Date: Mon, 20 Dec 2010 16:24:13 +0100	[thread overview]
Message-ID: <1292858662-5650-7-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1292858662-5650-1-git-send-email-fweisbec@gmail.com>

When a nohz task is running, don't stop the tick if RCU
needs the CPU to notify a quiescent state or if it has
callbacks to handle.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Anton Blanchard <anton@au1.ibm.com>
Cc: Tim Pepper <lnxninja@linux.vnet.ibm.com>
---
 include/linux/rcupdate.h |    1 +
 kernel/rcutree.c         |    3 +--
 kernel/sched.c           |    6 ++++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 03cda7b..262d48b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -122,6 +122,7 @@ extern void rcu_init(void);
 extern void rcu_sched_qs(int cpu);
 extern void rcu_bh_qs(int cpu);
 extern void rcu_check_callbacks(int cpu, int user);
+extern int rcu_pending(int cpu);
 struct notifier_block;
 
 #ifdef CONFIG_NO_HZ
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index ccdc04c..44dce3f 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -149,7 +149,6 @@ module_param(rcu_cpu_stall_suppress, int, 0644);
 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 
 static void force_quiescent_state(struct rcu_state *rsp, int relaxed);
-static int rcu_pending(int cpu);
 
 /*
  * Return the number of RCU-sched batches processed thus far for debug & stats.
@@ -1634,7 +1633,7 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
  * by the current CPU, returning 1 if so.  This function is part of the
  * RCU implementation; it is -not- an exported member of the RCU API.
  */
-static int rcu_pending(int cpu)
+int rcu_pending(int cpu)
 {
 	return __rcu_pending(&rcu_sched_state, &per_cpu(rcu_sched_data, cpu)) ||
 	       __rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)) ||
diff --git a/kernel/sched.c b/kernel/sched.c
index 6dbae46..45bd6e2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2470,10 +2470,16 @@ static void nohz_task_cpu_update(void *unused)
 int nohz_task_can_stop_tick(void)
 {
 	struct rq *rq = this_rq();
+	int cpu;
 
 	if (rq->nr_running > 1)
 		return 0;
 
+	cpu = smp_processor_id();
+
+	if (rcu_pending(cpu) || rcu_needs_cpu(cpu))
+		return 0;
+
 	return 1;
 }
 
-- 
1.7.3.2


  parent reply	other threads:[~2010-12-20 15:26 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20 15:24 [RFC PATCH 00/15] Nohz task support Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 01/15] nohz_task: New mask for cpus having nohz task Frederic Weisbecker
2010-12-24  8:00   ` Lai Jiangshan
2010-12-24  8:19     ` Dario Faggioli
2010-12-24 12:29       ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 02/15] nohz_task: Avoid nohz task cpu as non-idle timer target Frederic Weisbecker
2010-12-20 15:47   ` Peter Zijlstra
2010-12-20 16:06     ` Steven Rostedt
2010-12-20 16:12       ` Peter Zijlstra
2010-12-21  0:20         ` Frederic Weisbecker
2010-12-21  7:51           ` Peter Zijlstra
2010-12-21 13:58             ` Frederic Weisbecker
2010-12-21  0:13     ` Frederic Weisbecker
2010-12-21  7:50       ` Peter Zijlstra
2010-12-21 13:52         ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 03/15] nohz_task: Make tick stop and restart callable outside idle Frederic Weisbecker
2010-12-20 15:48   ` Peter Zijlstra
2010-12-20 16:19     ` Steven Rostedt
2010-12-20 16:25       ` Peter Zijlstra
2010-12-21  1:34         ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 04/15] nohz_task: Stop the tick when the nohz task runs alone Frederic Weisbecker
2010-12-20 15:51   ` Peter Zijlstra
2010-12-20 23:37     ` Frederic Weisbecker
2010-12-21  7:35       ` Peter Zijlstra
2010-12-21 13:22         ` Frederic Weisbecker
2010-12-21 14:34           ` Steven Rostedt
2010-12-21 15:14             ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 05/15] nohz_task: Restart the tick when another task compete on the cpu Frederic Weisbecker
2010-12-20 15:53   ` Peter Zijlstra
2010-12-20 23:39     ` Frederic Weisbecker
2010-12-20 15:24 ` Frederic Weisbecker [this message]
2010-12-20 15:58   ` [RFC PATCH 06/15] nohz_task: Keep the tick if rcu needs it Peter Zijlstra
2010-12-20 23:49     ` Frederic Weisbecker
2010-12-21  0:12       ` Jonathan Corbet
2010-12-21  2:10         ` Frederic Weisbecker
2010-12-21  8:10     ` Paul E. McKenney
2010-12-20 15:24 ` [RFC PATCH 07/15] nohz_task: Restart tick when RCU forces nohz task cpu quiescent state Frederic Weisbecker
2010-12-20 16:02   ` Peter Zijlstra
2010-12-20 23:52     ` Frederic Weisbecker
2010-12-21  7:41       ` Peter Zijlstra
2010-12-21 13:28         ` Frederic Weisbecker
2010-12-21 15:35         ` Paul E. McKenney
2010-12-20 15:24 ` [RFC PATCH 08/15] smp: Don't warn if irq are disabled but we don't wait for the ipi Frederic Weisbecker
2010-12-20 16:03   ` Peter Zijlstra
2010-12-21  0:02     ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 09/15] rcu: Make rcu_enter,exit_nohz() callable from irq Frederic Weisbecker
2010-12-21 19:26   ` Paul E. McKenney
2010-12-21 19:27     ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 10/15] nohz_task: Enter in extended quiescent state when in userspace Frederic Weisbecker
2010-12-20 16:18   ` Peter Zijlstra
2010-12-21  1:27     ` Frederic Weisbecker
2010-12-21  8:04       ` Peter Zijlstra
2010-12-21 14:06         ` Frederic Weisbecker
2010-12-21 19:28   ` Paul E. McKenney
2010-12-21 21:49     ` Frederic Weisbecker
2010-12-22  2:20       ` Paul E. McKenney
2010-12-20 15:24 ` [RFC PATCH 11/15] x86: Nohz task support Frederic Weisbecker
2010-12-20 16:23   ` Peter Zijlstra
2010-12-21  1:30     ` Frederic Weisbecker
2010-12-21  8:05       ` Peter Zijlstra
2010-12-21 14:19         ` Frederic Weisbecker
2010-12-21 15:12         ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 12/15] clocksource: Ignore nohz task cpu in clocksource watchdog Frederic Weisbecker
2010-12-20 16:27   ` Peter Zijlstra
2010-12-21  1:40     ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 13/15] sched: Protect nohz task cpu affinity Frederic Weisbecker
2010-12-20 16:28   ` Peter Zijlstra
2010-12-20 17:05     ` Steven Rostedt
2010-12-21  1:55       ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 14/15] nohz_task: Clear nohz task attribute on exit() Frederic Weisbecker
2010-12-20 16:30   ` Peter Zijlstra
2010-12-21  1:48     ` Frederic Weisbecker
2010-12-21  8:07       ` Peter Zijlstra
2010-12-21 14:22         ` Frederic Weisbecker
2010-12-20 15:24 ` [RFC PATCH 15/15] nohz_task: Procfs interface Frederic Weisbecker
2010-12-20 15:42   ` Peter Zijlstra
2010-12-20 15:57     ` Frederic Weisbecker
2010-12-20 16:16       ` Peter Zijlstra
2010-12-21  1:24         ` Frederic Weisbecker
2010-12-21  8:14           ` Peter Zijlstra
2010-12-21 14:00             ` Avi Kivity
2010-12-21 17:05               ` Frederic Weisbecker
2010-12-21 18:17                 ` Avi Kivity
2010-12-21 21:08                   ` Frederic Weisbecker
2010-12-22  9:22                     ` Avi Kivity
2010-12-22  9:51                       ` Peter Zijlstra
2010-12-22 20:41                         ` Frederic Weisbecker
2010-12-21 14:26             ` Frederic Weisbecker
2010-12-20 15:44 ` [RFC PATCH 00/15] Nohz task support Steven Rostedt
2010-12-20 23:33   ` Frederic Weisbecker
2010-12-21  1:36     ` Steven Rostedt
2010-12-21  2:15       ` Frederic Weisbecker
2010-12-21  7:34     ` Peter Zijlstra
2010-12-21 13:13       ` Frederic Weisbecker
2010-12-21 13:56     ` Avi Kivity
2010-12-21 17:01       ` Frederic Weisbecker
2010-12-20 16:35 ` Peter Zijlstra
2010-12-21  1:53   ` Frederic Weisbecker

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=1292858662-5650-7-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=anton@au1.ibm.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lnxninja@linux.vnet.ibm.com \
    --cc=mingo@elte.hu \
    --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