All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35
@ 2010-04-15 18:12 Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_resched for sending resched IPIs Paul E. McKenney
                   ` (17 more replies)
  0 siblings, 18 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

Hello!

RFC preview of RCU patches queued for 2.6.35, take 2.  Take 1 is at
http://lkml.org/lkml/2010/4/5/134.  Changes to old patches noted in
"[]", new patches flagged with "New".

 1.	substitute set_need_resched for sending resched IPIs
 	This reduces OS jitter.

 2.	make dead code really dead.  [Updated commit message as suggested
 	by Mathieu Desnoyers.]
 3.	move some code from macro to function
 	Cleanups from Lai Jiangshan.

 4.	ignore offline CPUs in last non dyntick idle CPU check
 	Fix to my CONFIG_RCU_FAST_NO_HZ code to handle offline and
	non-existent CPUs, also from Lai Jiangshan.

 5.	fix bogus CONFIG_PROVE_LOCKING in comments to reality
 6.	fix now bogus rcu_scheduler_active comments
 	Comment fixups.

 7.	shrink rcutiny by making synchronize_rcu_bh be inline
 	Shrink TINY_RCU some more.

 8.	rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk
 	First step towards TINY_PREEMPTIBLE_RCU.

 9.	refactor RCU's context switch handling
 	Reduce the number of needless softirqs.

10.	slim down rcutiny by removing rcu_scheduler_active and friends
	More shrinkage for TINY_RCU

11.	New: enable CPU_STALL_VERBOSE by default.  It will have been in one
	release, so time to enable it.

12.	New: disable CPU stall warnings upon panic

13.	New: print boot-time console messages if RCU configs out of ordinary

14.	New: improve RCU CPU stall-warning messages

15.	New: permit discontiguous cpu_possible_mask CPU numbering

16.	New: v2: reduce the number of spurious RCU_SOFTIRQ invocations

							Thanx, Paul


 b/Documentation/RCU/trace.txt |   35 ++++++------
 b/include/linux/rcupdate.h    |   15 ++---
 b/include/linux/rcutiny.h     |   12 +++-
 b/include/linux/rcutree.h     |    2 
 b/include/linux/srcu.h        |    4 -
 b/kernel/rcupdate.c           |   19 ------
 b/kernel/rcutiny.c            |    9 ---
 b/kernel/rcutiny_plugin.h     |   39 +++++++++++++
 b/kernel/rcutree.c            |   10 +++
 b/kernel/rcutree.h            |    1 
 b/kernel/rcutree_plugin.h     |    2 
 b/kernel/rcutree_trace.c      |    4 +
 b/kernel/sched.c              |    2 
 b/kernel/softirq.c            |    2 
 b/lib/Kconfig.debug           |    2 
 include/linux/rcupdate.h      |   12 +---
 include/linux/rcutiny.h       |   17 +++++
 include/linux/rcutree.h       |    4 +
 kernel/rcutiny.c              |   20 ++++--
 kernel/rcutree.c              |  121 +++++++++++++++++++++++++++++-------------
 kernel/rcutree.h              |    1 
 kernel/rcutree_plugin.h       |   55 +++++++++++++++++--
 22 files changed, 275 insertions(+), 113 deletions(-)

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_resched for sending resched IPIs
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead Paul E. McKenney
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

This patch adds a check to __rcu_pending() that does a local
set_need_resched() if the current CPU is holding up the current grace
period and if force_quiescent_state() will be called soon.  The goal is
to reduce the probability that force_quiescent_state() will need to do
smp_send_reschedule(), which sends an IPI and is therefore more expensive
on most architectures.

Signed-off-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 3ec8160..e54c123 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1499,6 +1499,16 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	/* Is the RCU core waiting for a quiescent state from this CPU? */
 	if (rdp->qs_pending) {
+
+		/*
+		 * If force_quiescent_state() coming soon and this CPU
+		 * needs a quiescent state, and this is either RCU-sched
+		 * or RCU-bh, force a local reschedule.
+		 */
+		if (!rdp->preemptable &&
+		    ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs) - 1,
+				 jiffies))
+			set_need_resched();
 		rdp->n_rp_qs_pending++;
 		return 1;
 	}
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_resched for sending resched IPIs Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 23:52   ` Josh Triplett
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 03/16] rcu: move some code from macro to function Paul E. McKenney
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

From: Lai Jiangshan <laijs@cn.fujitsu.com>

cleanup: make dead code really dead

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index e54c123..6042fb8 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
 		break; /* grace period idle or initializing, ignore. */
 
 	case RCU_SAVE_DYNTICK:
-
-		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
 		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
 			break; /* So gcc recognizes the dead code. */
 
+		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
+
 		/* Record dyntick-idle state. */
 		force_qs_rnp(rsp, dyntick_save_progress_counter);
 		raw_spin_lock(&rnp->lock);  /* irqs already disabled */
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 03/16] rcu: move some code from macro to function
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_resched for sending resched IPIs Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 04/16] rcu: ignore offline CPUs in last non-dyntick-idle CPU check Paul E. McKenney
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

From: Lai Jiangshan <laijs@cn.fujitsu.com>

Shrink the RCU_INIT_FLAVOR() macro by moving all but the initialization
of the ->rda[] array to rcu_init_one().  The call to rcu_init_one()
can then be moved to the end of the RCU_INIT_FLAVOR() macro, which is
required because rcu_boot_init_percpu_data(), which is now called from
rcu_init_one(), depends on the initialization of the ->rda[] array.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 6042fb8..86bb949 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1859,6 +1859,14 @@ static void __init rcu_init_one(struct rcu_state *rsp)
 			INIT_LIST_HEAD(&rnp->blocked_tasks[3]);
 		}
 	}
+
+	rnp = rsp->level[NUM_RCU_LVLS - 1];
+	for_each_possible_cpu(i) {
+		if (i > rnp->grphi)
+			rnp++;
+		rsp->rda[i]->mynode = rnp;
+		rcu_boot_init_percpu_data(i, rsp);
+	}
 }
 
 /*
@@ -1869,19 +1877,11 @@ static void __init rcu_init_one(struct rcu_state *rsp)
 #define RCU_INIT_FLAVOR(rsp, rcu_data) \
 do { \
 	int i; \
-	int j; \
-	struct rcu_node *rnp; \
 	\
-	rcu_init_one(rsp); \
-	rnp = (rsp)->level[NUM_RCU_LVLS - 1]; \
-	j = 0; \
 	for_each_possible_cpu(i) { \
-		if (i > rnp[j].grphi) \
-			j++; \
-		per_cpu(rcu_data, i).mynode = &rnp[j]; \
 		(rsp)->rda[i] = &per_cpu(rcu_data, i); \
-		rcu_boot_init_percpu_data(i, rsp); \
 	} \
+	rcu_init_one(rsp); \
 } while (0)
 
 void __init rcu_init(void)
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 04/16] rcu: ignore offline CPUs in last non-dyntick-idle CPU check
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (2 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 03/16] rcu: move some code from macro to function Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 05/16] rcu: Fix bogus CONFIG_PROVE_LOCKING in comments to reflect reality Paul E. McKenney
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

From: Lai Jiangshan <laijs@cn.fujitsu.com>

Offline CPUs are not in nohz_cpu_mask, but can be ignored when checking
for the last non-dyntick-idle CPU.  This patch therefore only checks
online CPUs for not being dyntick idle, allowing fast entry into
full-system dyntick-idle state even when there are some offline CPUs.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree_plugin.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 79b53bd..687c4e9 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -1016,7 +1016,7 @@ int rcu_needs_cpu(int cpu)
 
 	/* Don't bother unless we are the last non-dyntick-idle CPU. */
 	for_each_cpu_not(thatcpu, nohz_cpu_mask)
-		if (thatcpu != cpu) {
+		if (cpu_online(thatcpu) && thatcpu != cpu) {
 			per_cpu(rcu_dyntick_drain, cpu) = 0;
 			per_cpu(rcu_dyntick_holdoff, cpu) = jiffies - 1;
 			return rcu_needs_cpu_quick_check(cpu);
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 05/16] rcu: Fix bogus CONFIG_PROVE_LOCKING in comments to reflect reality.
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (3 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 04/16] rcu: ignore offline CPUs in last non-dyntick-idle CPU check Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 06/16] rcu: fix now-bogus rcu_scheduler_active comments Paul E. McKenney
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

It is CONFIG_DEBUG_LOCK_ALLOC rather than CONFIG_PROVE_LOCKING, so fix it.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/rcupdate.h |   15 ++++++++-------
 include/linux/srcu.h     |    4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 872a98e..91a5473 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -109,8 +109,8 @@ static inline int debug_lockdep_rcu_enabled(void)
 /**
  * rcu_read_lock_held - might we be in RCU read-side critical section?
  *
- * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
- * an RCU read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
+ * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
+ * read-side critical section.  In absence of CONFIG_DEBUG_LOCK_ALLOC,
  * this assumes we are in an RCU read-side critical section unless it can
  * prove otherwise.
  *
@@ -132,11 +132,12 @@ extern int rcu_read_lock_bh_held(void);
 /**
  * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
  *
- * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an
- * RCU-sched read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
- * this assumes we are in an RCU-sched read-side critical section unless it
- * can prove otherwise.  Note that disabling of preemption (including
- * disabling irqs) counts as an RCU-sched read-side critical section.
+ * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an
+ * RCU-sched read-side critical section.  In absence of
+ * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side
+ * critical section unless it can prove otherwise.  Note that disabling
+ * of preemption (including disabling irqs) counts as an RCU-sched
+ * read-side critical section.
  *
  * Check rcu_scheduler_active to prevent false positives during boot.
  */
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 4d5ecb2..9c01f10 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -84,8 +84,8 @@ long srcu_batches_completed(struct srcu_struct *sp);
 /**
  * srcu_read_lock_held - might we be in SRCU read-side critical section?
  *
- * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
- * an SRCU read-side critical section.  In absence of CONFIG_PROVE_LOCKING,
+ * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU
+ * read-side critical section.  In absence of CONFIG_DEBUG_LOCK_ALLOC,
  * this assumes we are in an SRCU read-side critical section unless it can
  * prove otherwise.
  */
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 06/16] rcu: fix now-bogus rcu_scheduler_active comments.
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (4 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 05/16] rcu: Fix bogus CONFIG_PROVE_LOCKING in comments to reflect reality Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline Paul E. McKenney
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

The rcu_scheduler_active check has been wrapped into the new
debug_lockdep_rcu_enabled() function, so update the comments to
reflect this new reality.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/rcupdate.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 91a5473..804ce3e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -114,7 +114,8 @@ static inline int debug_lockdep_rcu_enabled(void)
  * this assumes we are in an RCU read-side critical section unless it can
  * prove otherwise.
  *
- * Check rcu_scheduler_active to prevent false positives during boot.
+ * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
+ * and while lockdep is disabled.
  */
 static inline int rcu_read_lock_held(void)
 {
@@ -139,7 +140,8 @@ extern int rcu_read_lock_bh_held(void);
  * of preemption (including disabling irqs) counts as an RCU-sched
  * read-side critical section.
  *
- * Check rcu_scheduler_active to prevent false positives during boot.
+ * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
+ * and while lockdep is disabled.
  */
 #ifdef CONFIG_PREEMPT
 static inline int rcu_read_lock_sched_held(void)
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (5 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 06/16] rcu: fix now-bogus rcu_scheduler_active comments Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 08/16] rcu: rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk Paul E. McKenney
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

Because synchronize_rcu_bh() is identical to synchronize_sched(),
make the former a static inline invoking the latter, saving the
overhead of an EXPORT_SYMBOL_GPL() and the duplicate code.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/rcupdate.h |    2 --
 include/linux/rcutiny.h  |   12 +++++++++++-
 include/linux/rcutree.h  |    2 ++
 kernel/rcutiny.c         |    9 ++-------
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 804ce3e..56fa2d4 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -56,8 +56,6 @@ struct rcu_head {
 };
 
 /* Exported common interfaces */
-extern void synchronize_rcu_bh(void);
-extern void synchronize_sched(void);
 extern void rcu_barrier(void);
 extern void rcu_barrier_bh(void);
 extern void rcu_barrier_sched(void);
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index a519587..bbeb55b 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -74,7 +74,17 @@ static inline void rcu_sched_force_quiescent_state(void)
 {
 }
 
-#define synchronize_rcu synchronize_sched
+extern void synchronize_sched(void);
+
+static inline void synchronize_rcu(void)
+{
+	synchronize_sched();
+}
+
+static inline void synchronize_rcu_bh(void)
+{
+	synchronize_sched();
+}
 
 static inline void synchronize_rcu_expedited(void)
 {
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 42cc3a0..7484fe6 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -86,6 +86,8 @@ static inline void __rcu_read_unlock_bh(void)
 
 extern void call_rcu_sched(struct rcu_head *head,
 			   void (*func)(struct rcu_head *rcu));
+extern void synchronize_rcu_bh(void);
+extern void synchronize_sched(void);
 extern void synchronize_rcu_expedited(void);
 
 static inline void synchronize_rcu_bh_expedited(void)
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 9f6d9ff..272c6d2 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -187,7 +187,8 @@ static void rcu_process_callbacks(struct softirq_action *unused)
  *
  * Cool, huh?  (Due to Josh Triplett.)
  *
- * But we want to make this a static inline later.
+ * But we want to make this a static inline later.  The cond_resched()
+ * currently makes this problematic.
  */
 void synchronize_sched(void)
 {
@@ -195,12 +196,6 @@ void synchronize_sched(void)
 }
 EXPORT_SYMBOL_GPL(synchronize_sched);
 
-void synchronize_rcu_bh(void)
-{
-	synchronize_sched();
-}
-EXPORT_SYMBOL_GPL(synchronize_rcu_bh);
-
 /*
  * Helper function for call_rcu() and call_rcu_bh().
  */
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 08/16] rcu: rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (6 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 09/16] rcu: refactor RCU's context-switch handling Paul E. McKenney
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

Make naming line up in preparation for CONFIG_TINY_PREEMPT_RCU.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutiny.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 272c6d2..d9f8a62 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -44,9 +44,9 @@ struct rcu_ctrlblk {
 };
 
 /* Definition for rcupdate control block. */
-static struct rcu_ctrlblk rcu_ctrlblk = {
-	.donetail	= &rcu_ctrlblk.rcucblist,
-	.curtail	= &rcu_ctrlblk.rcucblist,
+static struct rcu_ctrlblk rcu_sched_ctrlblk = {
+	.donetail	= &rcu_sched_ctrlblk.rcucblist,
+	.curtail	= &rcu_sched_ctrlblk.rcucblist,
 };
 
 static struct rcu_ctrlblk rcu_bh_ctrlblk = {
@@ -108,7 +108,8 @@ static int rcu_qsctr_help(struct rcu_ctrlblk *rcp)
  */
 void rcu_sched_qs(int cpu)
 {
-	if (rcu_qsctr_help(&rcu_ctrlblk) + rcu_qsctr_help(&rcu_bh_ctrlblk))
+	if (rcu_qsctr_help(&rcu_sched_ctrlblk) +
+	    rcu_qsctr_help(&rcu_bh_ctrlblk))
 		raise_softirq(RCU_SOFTIRQ);
 }
 
@@ -173,7 +174,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
  */
 static void rcu_process_callbacks(struct softirq_action *unused)
 {
-	__rcu_process_callbacks(&rcu_ctrlblk);
+	__rcu_process_callbacks(&rcu_sched_ctrlblk);
 	__rcu_process_callbacks(&rcu_bh_ctrlblk);
 }
 
@@ -221,7 +222,7 @@ static void __call_rcu(struct rcu_head *head,
  */
 void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
 {
-	__call_rcu(head, func, &rcu_ctrlblk);
+	__call_rcu(head, func, &rcu_sched_ctrlblk);
 }
 EXPORT_SYMBOL_GPL(call_rcu);
 
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 09/16] rcu: refactor RCU's context-switch handling
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (7 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 08/16] rcu: rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends Paul E. McKenney
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

The addition of preemptible RCU to treercu resulted in a bit of
confusion and inefficiency surrounding the handling of context switches
for RCU-sched and for RCU-preempt.  For RCU-sched, a context switch
is a quiescent state, pure and simple, just like it always has been.
For RCU-preempt, a context switch is in no way a quiescent state, but
special handling is required when a task blocks in an RCU read-side
critical section.

However, the callout from the scheduler and the outer loop in ksoftirqd
still calls something named rcu_sched_qs(), whose name is no longer
accurate.  Furthermore, when rcu_check_callbacks() notes an RCU-sched
quiescent state, it ends up unnecessarily (though harmlessly, aside
from the performance hit) enqueuing the current task if it happens to
be running in an RCU-preempt read-side critical section.  This not only
increases the maximum latency of scheduler_tick(), it also needlessly
increases the overhead of the next outermost rcu_read_unlock() invocation.

This patch addresses this situation by separating the notion of RCU's
context-switch handling from that of RCU-sched's quiescent states.
The context-switch handling is covered by rcu_note_context_switch() in
general and by rcu_preempt_note_context_switch() for preemptible RCU.
This permits rcu_sched_qs() to handle quiescent states and only quiescent
states.  It also reduces the maximum latency of scheduler_tick(), though
probably by much less than a microsecond.  Finally, it means that tasks
within preemptible-RCU read-side critical sections avoid incurring the
overhead of queuing unless there really is a context switch.

Suggested-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/rcutiny.h |    4 ++++
 include/linux/rcutree.h |    1 +
 kernel/rcutree.c        |   17 ++++++++++++-----
 kernel/rcutree_plugin.h |   11 +++++++----
 kernel/sched.c          |    2 +-
 kernel/softirq.c        |    2 +-
 6 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index bbeb55b..ff22b97 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -29,6 +29,10 @@
 
 void rcu_sched_qs(int cpu);
 void rcu_bh_qs(int cpu);
+static inline void rcu_note_context_switch(int cpu)
+{
+	rcu_sched_qs(cpu);
+}
 
 #define __rcu_read_lock()	preempt_disable()
 #define __rcu_read_unlock()	preempt_enable()
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 7484fe6..b9f7460 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -34,6 +34,7 @@ struct notifier_block;
 
 extern void rcu_sched_qs(int cpu);
 extern void rcu_bh_qs(int cpu);
+extern void rcu_note_context_switch(int cpu);
 extern int rcu_needs_cpu(int cpu);
 extern int rcu_expedited_torture_stats(char *page);
 
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 86bb949..e336313 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -97,25 +97,32 @@ static int rcu_gp_in_progress(struct rcu_state *rsp)
  */
 void rcu_sched_qs(int cpu)
 {
-	struct rcu_data *rdp;
+	struct rcu_data *rdp = &per_cpu(rcu_sched_data, cpu);
 
-	rdp = &per_cpu(rcu_sched_data, cpu);
 	rdp->passed_quiesc_completed = rdp->gpnum - 1;
 	barrier();
 	rdp->passed_quiesc = 1;
-	rcu_preempt_note_context_switch(cpu);
 }
 
 void rcu_bh_qs(int cpu)
 {
-	struct rcu_data *rdp;
+	struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
 
-	rdp = &per_cpu(rcu_bh_data, cpu);
 	rdp->passed_quiesc_completed = rdp->gpnum - 1;
 	barrier();
 	rdp->passed_quiesc = 1;
 }
 
+/*
+ * Note a context switch.  This is a quiescent state for RCU-sched,
+ * and requires special handling for preemptible RCU.
+ */
+void rcu_note_context_switch(int cpu)
+{
+	rcu_sched_qs(cpu);
+	rcu_preempt_note_context_switch(cpu);
+}
+
 #ifdef CONFIG_NO_HZ
 DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
 	.dynticks_nesting = 1,
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 687c4e9..f9bc83a 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -75,13 +75,19 @@ EXPORT_SYMBOL_GPL(rcu_force_quiescent_state);
  * that this just means that the task currently running on the CPU is
  * not in a quiescent state.  There might be any number of tasks blocked
  * while in an RCU read-side critical section.
+ *
+ * Unlike the other rcu_*_qs() functions, callers to this function
+ * must disable irqs in order to protect the assignment to
+ * ->rcu_read_unlock_special.
  */
 static void rcu_preempt_qs(int cpu)
 {
 	struct rcu_data *rdp = &per_cpu(rcu_preempt_data, cpu);
+
 	rdp->passed_quiesc_completed = rdp->gpnum - 1;
 	barrier();
 	rdp->passed_quiesc = 1;
+	current->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
 }
 
 /*
@@ -144,9 +150,8 @@ static void rcu_preempt_note_context_switch(int cpu)
 	 * grace period, then the fact that the task has been enqueued
 	 * means that we continue to block the current grace period.
 	 */
-	rcu_preempt_qs(cpu);
 	local_irq_save(flags);
-	t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
+	rcu_preempt_qs(cpu);
 	local_irq_restore(flags);
 }
 
@@ -236,7 +241,6 @@ static void rcu_read_unlock_special(struct task_struct *t)
 	 */
 	special = t->rcu_read_unlock_special;
 	if (special & RCU_READ_UNLOCK_NEED_QS) {
-		t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
 		rcu_preempt_qs(smp_processor_id());
 	}
 
@@ -473,7 +477,6 @@ static void rcu_preempt_check_callbacks(int cpu)
 	struct task_struct *t = current;
 
 	if (t->rcu_read_lock_nesting == 0) {
-		t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
 		rcu_preempt_qs(cpu);
 		return;
 	}
diff --git a/kernel/sched.c b/kernel/sched.c
index 9ab3cd7..d78a9dd 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3695,7 +3695,7 @@ need_resched:
 	preempt_disable();
 	cpu = smp_processor_id();
 	rq = cpu_rq(cpu);
-	rcu_sched_qs(cpu);
+	rcu_note_context_switch(cpu);
 	prev = rq->curr;
 	switch_count = &prev->nivcsw;
 
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 7c1a67e..0db913a 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -716,7 +716,7 @@ static int run_ksoftirqd(void * __bind_cpu)
 			preempt_enable_no_resched();
 			cond_resched();
 			preempt_disable();
-			rcu_sched_qs((long)__bind_cpu);
+			rcu_note_context_switch((long)__bind_cpu);
 		}
 		preempt_enable();
 		set_current_state(TASK_INTERRUPTIBLE);
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (8 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 09/16] rcu: refactor RCU's context-switch handling Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 11/16] rcu: enable CPU_STALL_VERBOSE by default Paul E. McKenney
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

TINY_RCU does not need rcu_scheduler_active unless CONFIG_DEBUG_LOCK_ALLOC.
So conditionally compile rcu_scheduler_active in order to slim down
rcutiny a bit more.  Also gets rid of an EXPORT_SYMBOL_GPL, which is
responsible for most of the slimming.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/rcupdate.h |    4 +---
 include/linux/rcutiny.h  |   13 +++++++++++++
 include/linux/rcutree.h  |    3 +++
 kernel/rcupdate.c        |   19 -------------------
 kernel/rcutiny.c         |    7 +++++++
 kernel/rcutiny_plugin.h  |   39 +++++++++++++++++++++++++++++++++++++++
 kernel/rcutree.c         |   19 +++++++++++++++++++
 7 files changed, 82 insertions(+), 22 deletions(-)
 create mode 100644 kernel/rcutiny_plugin.h

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 56fa2d4..7a411b7 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -64,8 +64,6 @@ extern int sched_expedited_torture_stats(char *page);
 
 /* Internal to kernel */
 extern void rcu_init(void);
-extern int rcu_scheduler_active;
-extern void rcu_scheduler_starting(void);
 
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
 #include <linux/rcutree.h>
@@ -181,7 +179,7 @@ static inline int rcu_read_lock_bh_held(void)
 #ifdef CONFIG_PREEMPT
 static inline int rcu_read_lock_sched_held(void)
 {
-	return !rcu_scheduler_active || preempt_count() != 0 || irqs_disabled();
+	return preempt_count() != 0 || irqs_disabled();
 }
 #else /* #ifdef CONFIG_PREEMPT */
 static inline int rcu_read_lock_sched_held(void)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index ff22b97..14e5a76 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -128,4 +128,17 @@ static inline int rcu_preempt_depth(void)
 	return 0;
 }
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+
+extern int rcu_scheduler_active __read_mostly;
+extern void rcu_scheduler_starting(void);
+
+#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
+static inline void rcu_scheduler_starting(void)
+{
+}
+
+#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
 #endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index b9f7460..4828205 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -123,4 +123,7 @@ static inline int rcu_blocking_is_gp(void)
 	return num_online_cpus() == 1;
 }
 
+extern void rcu_scheduler_starting(void);
+extern int rcu_scheduler_active __read_mostly;
+
 #endif /* __LINUX_RCUTREE_H */
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 63fe254..9b19fee 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -44,7 +44,6 @@
 #include <linux/cpu.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
-#include <linux/kernel_stat.h>
 #include <linux/hardirq.h>
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -64,9 +63,6 @@ struct lockdep_map rcu_sched_lock_map =
 EXPORT_SYMBOL_GPL(rcu_sched_lock_map);
 #endif
 
-int rcu_scheduler_active __read_mostly;
-EXPORT_SYMBOL_GPL(rcu_scheduler_active);
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 
 /**
@@ -90,21 +86,6 @@ EXPORT_SYMBOL_GPL(rcu_read_lock_bh_held);
 #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
 
 /*
- * This function is invoked towards the end of the scheduler's initialization
- * process.  Before this is called, the idle task might contain
- * RCU read-side critical sections (during which time, this idle
- * task is booting the system).  After this function is called, the
- * idle tasks are prohibited from containing RCU read-side critical
- * sections.
- */
-void rcu_scheduler_starting(void)
-{
-	WARN_ON(num_online_cpus() != 1);
-	WARN_ON(nr_context_switches() > 0);
-	rcu_scheduler_active = 1;
-}
-
-/*
  * Awaken the corresponding synchronize_rcu() instance now that a
  * grace period has elapsed.
  */
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index d9f8a62..b1804ff 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -54,6 +54,11 @@ static struct rcu_ctrlblk rcu_bh_ctrlblk = {
 	.curtail	= &rcu_bh_ctrlblk.rcucblist,
 };
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+int rcu_scheduler_active __read_mostly;
+EXPORT_SYMBOL_GPL(rcu_scheduler_active);
+#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
+
 #ifdef CONFIG_NO_HZ
 
 static long rcu_dynticks_nesting = 1;
@@ -276,3 +281,5 @@ void __init rcu_init(void)
 {
 	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
 }
+
+#include "rcutiny_plugin.h"
diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
new file mode 100644
index 0000000..d223a92
--- /dev/null
+++ b/kernel/rcutiny_plugin.h
@@ -0,0 +1,39 @@
+/*
+ * Read-Copy Update mechanism for mutual exclusion (tree-based version)
+ * Internal non-public definitions that provide either classic
+ * or preemptable semantics.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright IBM Corporation, 2009
+ *
+ * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+ */
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+
+#include <linux/kernel_stat.h>
+
+/*
+ * During boot, we forgive RCU lockdep issues.  After this function is
+ * invoked, we start taking RCU lockdep issues seriously.
+ */
+void rcu_scheduler_starting(void)
+{
+	WARN_ON(nr_context_switches() > 0);
+	rcu_scheduler_active = 1;
+}
+
+#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index e336313..3623f8e 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -46,6 +46,7 @@
 #include <linux/cpu.h>
 #include <linux/mutex.h>
 #include <linux/time.h>
+#include <linux/kernel_stat.h>
 
 #include "rcutree.h"
 
@@ -80,6 +81,9 @@ DEFINE_PER_CPU(struct rcu_data, rcu_sched_data);
 struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
 DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
 
+int rcu_scheduler_active __read_mostly;
+EXPORT_SYMBOL_GPL(rcu_scheduler_active);
+
 /*
  * Return true if an RCU grace period is in progress.  The ACCESS_ONCE()s
  * permit this function to be invoked without holding the root rcu_node
@@ -1784,6 +1788,21 @@ static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
 }
 
 /*
+ * This function is invoked towards the end of the scheduler's initialization
+ * process.  Before this is called, the idle task might contain
+ * RCU read-side critical sections (during which time, this idle
+ * task is booting the system).  After this function is called, the
+ * idle tasks are prohibited from containing RCU read-side critical
+ * sections.  This function also enables RCU lockdep checking.
+ */
+void rcu_scheduler_starting(void)
+{
+	WARN_ON(num_online_cpus() != 1);
+	WARN_ON(nr_context_switches() > 0);
+	rcu_scheduler_active = 1;
+}
+
+/*
  * Compute the per-level fanout, either using the exact fanout specified
  * or balancing the tree, depending on CONFIG_RCU_FANOUT_EXACT.
  */
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 11/16] rcu: enable CPU_STALL_VERBOSE by default
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (9 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 12/16] rcu: disable CPU stall warnings upon panic Paul E. McKenney
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

The CPU_STALL_VERBOSE kernel configuration parameter was added to
2.6.34 to identify any preempted/blocked tasks that were preventing
the current grace period from completing when running preemptible
RCU.  As is conventional for new configurations parameters, this
defaulted disabled.  It is now time to enable it by default.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 lib/Kconfig.debug |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 8e5ec5e..4194e21 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -792,7 +792,7 @@ config RCU_CPU_STALL_DETECTOR
 config RCU_CPU_STALL_VERBOSE
 	bool "Print additional per-task information for RCU_CPU_STALL_DETECTOR"
 	depends on RCU_CPU_STALL_DETECTOR && TREE_PREEMPT_RCU
-	default n
+	default y
 	help
 	  This option causes RCU to printk detailed per-task information
 	  for any tasks that are stalling the current RCU grace period.
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 12/16] rcu: disable CPU stall warnings upon panic
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (10 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 11/16] rcu: enable CPU_STALL_VERBOSE by default Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 13/16] rcu: print boot-time console messages if RCU configs out of ordinary Paul E. McKenney
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

The current RCU CPU stall warnings remain enabled even after a panic
occurs, which some people have found to be a bit counterproductive.
This patch therefore uses a notifier to disable stall warnings once a
panic occurs.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 3623f8e..595fb83 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -449,6 +449,8 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
 
 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
 
+int rcu_cpu_stall_panicking __read_mostly;
+
 static void record_gp_stall_check_time(struct rcu_state *rsp)
 {
 	rsp->gp_start = jiffies;
@@ -526,6 +528,8 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 	long delta;
 	struct rcu_node *rnp;
 
+	if (rcu_cpu_stall_panicking)
+		return;
 	delta = jiffies - rsp->jiffies_stall;
 	rnp = rdp->mynode;
 	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
@@ -540,6 +544,21 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 	}
 }
 
+static int rcu_panic(struct notifier_block *this, unsigned long ev, void *ptr)
+{
+	rcu_cpu_stall_panicking = 1;
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block rcu_panic_block = {
+	.notifier_call = rcu_panic,
+};
+
+static void __init check_cpu_stall_init(void)
+{
+	atomic_notifier_chain_register(&panic_notifier_list, &rcu_panic_block);
+}
+
 #else /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 
 static void record_gp_stall_check_time(struct rcu_state *rsp)
@@ -550,6 +569,10 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 {
 }
 
+static void __init check_cpu_stall_init(void)
+{
+}
+
 #endif /* #else #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
 
 /*
@@ -1934,6 +1957,7 @@ void __init rcu_init(void)
 	cpu_notifier(rcu_cpu_notify, 0);
 	for_each_online_cpu(cpu)
 		rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
+	check_cpu_stall_init();
 }
 
 #include "rcutree_plugin.h"
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 13/16] rcu: print boot-time console messages if RCU configs out of ordinary
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (11 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 12/16] rcu: disable CPU stall warnings upon panic Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 14/16] rcu: improve RCU CPU stall-warning messages Paul E. McKenney
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

Print boot-time messages if tracing is enabled, if fanout is set
to non-default values, if exact fanout is specified, if accelerated
dyntick-idle grace periods have been enabled, if RCU-lockdep is enabled,
if rcutorture has been boot-time enabled, if the CPU stall detector has
been disabled, or if four-level hierarchy has been enabled.

This is all for TREE_RCU and TREE_PREEMPT_RCU.  TINY_RCU will be handled
separately, if at all.

Suggested-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c        |    6 ------
 kernel/rcutree_plugin.h |   44 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 595fb83..ec6196f 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1938,12 +1938,6 @@ void __init rcu_init(void)
 	int cpu;
 
 	rcu_bootup_announce();
-#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
-	printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n");
-#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
-#if NUM_RCU_LVL_4 != 0
-	printk(KERN_INFO "Experimental four-level hierarchy is enabled.\n");
-#endif /* #if NUM_RCU_LVL_4 != 0 */
 	RCU_INIT_FLAVOR(&rcu_sched_state, rcu_sched_data);
 	RCU_INIT_FLAVOR(&rcu_bh_state, rcu_bh_data);
 	__rcu_init_preempt();
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index f9bc83a..0ae2339 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -26,6 +26,45 @@
 
 #include <linux/delay.h>
 
+/*
+ * Check the RCU kernel configuration parameters and print informative
+ * messages about anything out of the ordinary.  If you like #ifdef, you
+ * will love this function.
+ */
+static void __init rcu_bootup_announce_oddness(void)
+{
+#ifdef CONFIG_RCU_TRACE
+	printk(KERN_INFO "\tRCU debugfs-based tracing is enabled.\n");
+#endif
+#if (defined(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 64) || (!defined(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 32)
+	printk(KERN_INFO "\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
+	       CONFIG_RCU_FANOUT);
+#endif
+#ifdef CONFIG_RCU_FANOUT_EXACT
+	printk(KERN_INFO "\tHierarchical RCU autobalancing is disabled.\n");
+#endif
+#ifdef CONFIG_RCU_FAST_NO_HZ
+	printk(KERN_INFO
+	       "\tRCU dyntick-idle grace-period acceleration is enabled.\n");
+#endif
+#ifdef CONFIG_PROVE_RCU
+	printk(KERN_INFO "\tRCU lockdep checking is enabled.\n");
+#endif
+#ifdef CONFIG_RCU_TORTURE_TEST_RUNNABLE
+	printk(KERN_INFO "\tRCU torture testing starts during boot.\n");
+#endif
+#ifndef CONFIG_RCU_CPU_STALL_DETECTOR
+	printk(KERN_INFO
+	       "\tRCU-based detection of stalled CPUs is disabled.\n");
+#endif
+#ifndef CONFIG_RCU_CPU_STALL_VERBOSE
+	printk(KERN_INFO "\tVerbose stalled-CPUs detection is disabled.\n");
+#endif
+#if NUM_RCU_LVL_4 != 0
+	printk(KERN_INFO "\tExperimental four-level hierarchy is enabled.\n");
+#endif
+}
+
 #ifdef CONFIG_TREE_PREEMPT_RCU
 
 struct rcu_state rcu_preempt_state = RCU_STATE_INITIALIZER(rcu_preempt_state);
@@ -38,8 +77,8 @@ static int rcu_preempted_readers_exp(struct rcu_node *rnp);
  */
 static void __init rcu_bootup_announce(void)
 {
-	printk(KERN_INFO
-	       "Experimental preemptable hierarchical RCU implementation.\n");
+	printk(KERN_INFO "Preemptable hierarchical RCU implementation.\n");
+	rcu_bootup_announce_oddness();
 }
 
 /*
@@ -757,6 +796,7 @@ void exit_rcu(void)
 static void __init rcu_bootup_announce(void)
 {
 	printk(KERN_INFO "Hierarchical RCU implementation.\n");
+	rcu_bootup_announce_oddness();
 }
 
 /*
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 14/16] rcu: improve RCU CPU stall-warning messages
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (12 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 13/16] rcu: print boot-time console messages if RCU configs out of ordinary Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 15/16] rcu: permit discontiguous cpu_possible_mask CPU numbering Paul E. McKenney
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

The existing RCU CPU stall-warning messages can be confusing, especially
in the case where one CPU detects a single other stalled CPU.  In addition,
the console messages did not say which flavor of RCU detected the stall,
which can make it difficult to work out exactly what is causing the stall.
This commit improves these messages.

Requested-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |   20 +++++++++++---------
 kernel/rcutree.h |    1 +
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index ec6196f..f391886 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -54,8 +54,8 @@
 
 static struct lock_class_key rcu_node_class[NUM_RCU_LVLS];
 
-#define RCU_STATE_INITIALIZER(name) { \
-	.level = { &name.node[0] }, \
+#define RCU_STATE_INITIALIZER(structname) { \
+	.level = { &structname.node[0] }, \
 	.levelcnt = { \
 		NUM_RCU_LVL_0,  /* root of hierarchy. */ \
 		NUM_RCU_LVL_1, \
@@ -66,13 +66,14 @@ static struct lock_class_key rcu_node_class[NUM_RCU_LVLS];
 	.signaled = RCU_GP_IDLE, \
 	.gpnum = -300, \
 	.completed = -300, \
-	.onofflock = __RAW_SPIN_LOCK_UNLOCKED(&name.onofflock), \
+	.onofflock = __RAW_SPIN_LOCK_UNLOCKED(&structname.onofflock), \
 	.orphan_cbs_list = NULL, \
-	.orphan_cbs_tail = &name.orphan_cbs_list, \
+	.orphan_cbs_tail = &structname.orphan_cbs_list, \
 	.orphan_qlen = 0, \
-	.fqslock = __RAW_SPIN_LOCK_UNLOCKED(&name.fqslock), \
+	.fqslock = __RAW_SPIN_LOCK_UNLOCKED(&structname.fqslock), \
 	.n_force_qs = 0, \
 	.n_force_qs_ngp = 0, \
+	.name = #structname, \
 }
 
 struct rcu_state rcu_sched_state = RCU_STATE_INITIALIZER(rcu_sched_state);
@@ -483,7 +484,8 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
 
 	/* OK, time to rat on our buddy... */
 
-	printk(KERN_ERR "INFO: RCU detected CPU stalls:");
+	printk(KERN_ERR "INFO: %s detected stalls on CPUs/tasks: {",
+	       rsp->name);
 	rcu_for_each_leaf_node(rsp, rnp) {
 		raw_spin_lock_irqsave(&rnp->lock, flags);
 		rcu_print_task_stall(rnp);
@@ -494,7 +496,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp)
 			if (rnp->qsmask & (1UL << cpu))
 				printk(" %d", rnp->grplo + cpu);
 	}
-	printk(" (detected by %d, t=%ld jiffies)\n",
+	printk("} (detected by %d, t=%ld jiffies)\n",
 	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
 	trigger_all_cpu_backtrace();
 
@@ -510,8 +512,8 @@ static void print_cpu_stall(struct rcu_state *rsp)
 	unsigned long flags;
 	struct rcu_node *rnp = rcu_get_root(rsp);
 
-	printk(KERN_ERR "INFO: RCU detected CPU %d stall (t=%lu jiffies)\n",
-			smp_processor_id(), jiffies - rsp->gp_start);
+	printk(KERN_ERR "INFO: %s detected stall on CPU %d (t=%lu jiffies)\n",
+	       rsp->name, smp_processor_id(), jiffies - rsp->gp_start);
 	trigger_all_cpu_backtrace();
 
 	raw_spin_lock_irqsave(&rnp->lock, flags);
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 4a525a3..11f1711 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -326,6 +326,7 @@ struct rcu_state {
 	unsigned long jiffies_stall;		/* Time at which to check */
 						/*  for CPU stalls. */
 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
+	char *name;				/* Name of structure. */
 };
 
 /* Return values for rcu_preempt_offline_tasks(). */
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 15/16] rcu: permit discontiguous cpu_possible_mask CPU numbering
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (13 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 14/16] rcu: improve RCU CPU stall-warning messages Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 16/16] rcu: v2: reduce the number of spurious RCU_SOFTIRQ invocations Paul E. McKenney
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

TREE_RCU assumes that CPU numbering is contiguous, but some users need
large holes in the numbering to better map to hardware layout.  This patch
makes TREE_RCU (and TREE_PREEMPT_RCU) tolerate large holes in the CPU
numbering.  However, NR_CPUS must still be greater than the largest
CPU number.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index f391886..c60fd74 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1913,7 +1913,7 @@ static void __init rcu_init_one(struct rcu_state *rsp)
 
 	rnp = rsp->level[NUM_RCU_LVLS - 1];
 	for_each_possible_cpu(i) {
-		if (i > rnp->grphi)
+		while (i > rnp->grphi)
 			rnp++;
 		rsp->rda[i]->mynode = rnp;
 		rcu_boot_init_percpu_data(i, rsp);
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH RFC tip/core/rcu 16/16] rcu: v2: reduce the number of spurious RCU_SOFTIRQ invocations
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (14 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 15/16] rcu: permit discontiguous cpu_possible_mask CPU numbering Paul E. McKenney
@ 2010-04-15 18:13 ` Paul E. McKenney
  2010-04-20 10:11 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline David Howells
  2010-04-20 10:15 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends David Howells
  17 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-15 18:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet, Paul E. McKenney

Lai Jiangshan noted that up to 10% of the RCU_SOFTIRQ are spurious, and
traced this down to the fact that the current grace-period machinery
will uselessly raise RCU_SOFTIRQ when a given CPU needs to go through
a quiescent state, but has not yet done so.  In this situation, there
might well be nothing that RCU_SOFTIRQ can do, and the overhead can be
worth worrying about in the ksoftirqd case.  This patch therefore avoids
raising RCU_SOFTIRQ in this situation.

Changes since v1 (http://lkml.org/lkml/2010/3/30/122 from Lai Jiangshan):

o	Omit the rcu_qs_pending() prechecks, as they aren't that
	much less expensive than the quiescent-state checks.

o	Merge with the set_need_resched() patch that reduces IPIs.

o	Add the new n_rp_report_qs field to the rcu_pending tracing output.

o	Update the tracing documentation accordingly.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 Documentation/RCU/trace.txt |   35 +++++++++++++++++++----------------
 kernel/rcutree.c            |   11 ++++++-----
 kernel/rcutree.h            |    1 +
 kernel/rcutree_trace.c      |    4 +++-
 4 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/Documentation/RCU/trace.txt b/Documentation/RCU/trace.txt
index 8608fd8..efd8cc9 100644
--- a/Documentation/RCU/trace.txt
+++ b/Documentation/RCU/trace.txt
@@ -256,23 +256,23 @@ o	Each element of the form "1/1 0:127 ^0" represents one struct
 The output of "cat rcu/rcu_pending" looks as follows:
 
 rcu_sched:
-  0 np=255892 qsp=53936 cbr=0 cng=14417 gpc=10033 gps=24320 nf=6445 nn=146741
-  1 np=261224 qsp=54638 cbr=0 cng=25723 gpc=16310 gps=2849 nf=5912 nn=155792
-  2 np=237496 qsp=49664 cbr=0 cng=2762 gpc=45478 gps=1762 nf=1201 nn=136629
-  3 np=236249 qsp=48766 cbr=0 cng=286 gpc=48049 gps=1218 nf=207 nn=137723
-  4 np=221310 qsp=46850 cbr=0 cng=26 gpc=43161 gps=4634 nf=3529 nn=123110
-  5 np=237332 qsp=48449 cbr=0 cng=54 gpc=47920 gps=3252 nf=201 nn=137456
-  6 np=219995 qsp=46718 cbr=0 cng=50 gpc=42098 gps=6093 nf=4202 nn=120834
-  7 np=249893 qsp=49390 cbr=0 cng=72 gpc=38400 gps=17102 nf=41 nn=144888
+  0 np=255892 qsp=53936 rpq=85 cbr=0 cng=14417 gpc=10033 gps=24320 nf=6445 nn=146741
+  1 np=261224 qsp=54638 rpq=33 cbr=0 cng=25723 gpc=16310 gps=2849 nf=5912 nn=155792
+  2 np=237496 qsp=49664 rpq=23 cbr=0 cng=2762 gpc=45478 gps=1762 nf=1201 nn=136629
+  3 np=236249 qsp=48766 rpq=98 cbr=0 cng=286 gpc=48049 gps=1218 nf=207 nn=137723
+  4 np=221310 qsp=46850 rpq=7 cbr=0 cng=26 gpc=43161 gps=4634 nf=3529 nn=123110
+  5 np=237332 qsp=48449 rpq=9 cbr=0 cng=54 gpc=47920 gps=3252 nf=201 nn=137456
+  6 np=219995 qsp=46718 rpq=12 cbr=0 cng=50 gpc=42098 gps=6093 nf=4202 nn=120834
+  7 np=249893 qsp=49390 rpq=42 cbr=0 cng=72 gpc=38400 gps=17102 nf=41 nn=144888
 rcu_bh:
-  0 np=146741 qsp=1419 cbr=0 cng=6 gpc=0 gps=0 nf=2 nn=145314
-  1 np=155792 qsp=12597 cbr=0 cng=0 gpc=4 gps=8 nf=3 nn=143180
-  2 np=136629 qsp=18680 cbr=0 cng=0 gpc=7 gps=6 nf=0 nn=117936
-  3 np=137723 qsp=2843 cbr=0 cng=0 gpc=10 gps=7 nf=0 nn=134863
-  4 np=123110 qsp=12433 cbr=0 cng=0 gpc=4 gps=2 nf=0 nn=110671
-  5 np=137456 qsp=4210 cbr=0 cng=0 gpc=6 gps=5 nf=0 nn=133235
-  6 np=120834 qsp=9902 cbr=0 cng=0 gpc=6 gps=3 nf=2 nn=110921
-  7 np=144888 qsp=26336 cbr=0 cng=0 gpc=8 gps=2 nf=0 nn=118542
+  0 np=146741 qsp=1419 rpq=6 cbr=0 cng=6 gpc=0 gps=0 nf=2 nn=145314
+  1 np=155792 qsp=12597 rpq=3 cbr=0 cng=0 gpc=4 gps=8 nf=3 nn=143180
+  2 np=136629 qsp=18680 rpq=1 cbr=0 cng=0 gpc=7 gps=6 nf=0 nn=117936
+  3 np=137723 qsp=2843 rpq=0 cbr=0 cng=0 gpc=10 gps=7 nf=0 nn=134863
+  4 np=123110 qsp=12433 rpq=0 cbr=0 cng=0 gpc=4 gps=2 nf=0 nn=110671
+  5 np=137456 qsp=4210 rpq=1 cbr=0 cng=0 gpc=6 gps=5 nf=0 nn=133235
+  6 np=120834 qsp=9902 rpq=2 cbr=0 cng=0 gpc=6 gps=3 nf=2 nn=110921
+  7 np=144888 qsp=26336 rpq=0 cbr=0 cng=0 gpc=8 gps=2 nf=0 nn=118542
 
 As always, this is once again split into "rcu_sched" and "rcu_bh"
 portions, with CONFIG_TREE_PREEMPT_RCU kernels having an additional
@@ -284,6 +284,9 @@ o	"np" is the number of times that __rcu_pending() has been invoked
 o	"qsp" is the number of times that the RCU was waiting for a
 	quiescent state from this CPU.
 
+o	"rpq" is the number of times that the CPU had passed through
+	a quiescent state, but not yet reported it to RCU.
+
 o	"cbr" is the number of times that this CPU had RCU callbacks
 	that had passed through a grace period, and were thus ready
 	to be invoked.
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index c60fd74..ba69969 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1161,8 +1161,6 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
  */
 void rcu_check_callbacks(int cpu, int user)
 {
-	if (!rcu_pending(cpu))
-		return; /* if nothing for RCU to do. */
 	if (user ||
 	    (idle_cpu(cpu) && rcu_scheduler_active &&
 	     !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) {
@@ -1194,7 +1192,8 @@ void rcu_check_callbacks(int cpu, int user)
 		rcu_bh_qs(cpu);
 	}
 	rcu_preempt_check_callbacks(cpu);
-	raise_softirq(RCU_SOFTIRQ);
+	if (rcu_pending(cpu))
+		raise_softirq(RCU_SOFTIRQ);
 }
 
 #ifdef CONFIG_SMP
@@ -1534,18 +1533,20 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
 	check_cpu_stall(rsp, rdp);
 
 	/* Is the RCU core waiting for a quiescent state from this CPU? */
-	if (rdp->qs_pending) {
+	if (rdp->qs_pending && !rdp->passed_quiesc) {
 
 		/*
 		 * If force_quiescent_state() coming soon and this CPU
 		 * needs a quiescent state, and this is either RCU-sched
 		 * or RCU-bh, force a local reschedule.
 		 */
+		rdp->n_rp_qs_pending++;
 		if (!rdp->preemptable &&
 		    ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs) - 1,
 				 jiffies))
 			set_need_resched();
-		rdp->n_rp_qs_pending++;
+	} else if (rdp->qs_pending && rdp->passed_quiesc) {
+		rdp->n_rp_report_qs++;
 		return 1;
 	}
 
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 11f1711..14c040b 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -223,6 +223,7 @@ struct rcu_data {
 	/* 5) __rcu_pending() statistics. */
 	unsigned long n_rcu_pending;	/* rcu_pending() calls since boot. */
 	unsigned long n_rp_qs_pending;
+	unsigned long n_rp_report_qs;
 	unsigned long n_rp_cb_ready;
 	unsigned long n_rp_cpu_needs_gp;
 	unsigned long n_rp_gp_completed;
diff --git a/kernel/rcutree_trace.c b/kernel/rcutree_trace.c
index d45db2e..36c95b4 100644
--- a/kernel/rcutree_trace.c
+++ b/kernel/rcutree_trace.c
@@ -241,11 +241,13 @@ static const struct file_operations rcugp_fops = {
 static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp)
 {
 	seq_printf(m, "%3d%cnp=%ld "
-		   "qsp=%ld cbr=%ld cng=%ld gpc=%ld gps=%ld nf=%ld nn=%ld\n",
+		   "qsp=%ld rpq=%ld cbr=%ld cng=%ld "
+		   "gpc=%ld gps=%ld nf=%ld nn=%ld\n",
 		   rdp->cpu,
 		   cpu_is_offline(rdp->cpu) ? '!' : ' ',
 		   rdp->n_rcu_pending,
 		   rdp->n_rp_qs_pending,
+		   rdp->n_rp_report_qs,
 		   rdp->n_rp_cb_ready,
 		   rdp->n_rp_cpu_needs_gp,
 		   rdp->n_rp_gp_completed,
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead Paul E. McKenney
@ 2010-04-15 23:52   ` Josh Triplett
  2010-04-16 14:23     ` Paul E. McKenney
  0 siblings, 1 reply; 31+ messages in thread
From: Josh Triplett @ 2010-04-15 23:52 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> From: Lai Jiangshan <laijs@cn.fujitsu.com>
> 
> cleanup: make dead code really dead
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
>  kernel/rcutree.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index e54c123..6042fb8 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
>  		break; /* grace period idle or initializing, ignore. */
>  
>  	case RCU_SAVE_DYNTICK:
> -
> -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
>  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
>  			break; /* So gcc recognizes the dead code. */

GCC's new __builtin_unreachable would help here, though obviously we
can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
let us use it when available though.

- Josh Triplett

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-15 23:52   ` Josh Triplett
@ 2010-04-16 14:23     ` Paul E. McKenney
  2010-04-16 21:16       ` Josh Triplett
  0 siblings, 1 reply; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-16 14:23 UTC (permalink / raw)
  To: Josh Triplett
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > 
> > cleanup: make dead code really dead
> > 
> > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > ---
> >  kernel/rcutree.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > index e54c123..6042fb8 100644
> > --- a/kernel/rcutree.c
> > +++ b/kernel/rcutree.c
> > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> >  		break; /* grace period idle or initializing, ignore. */
> >  
> >  	case RCU_SAVE_DYNTICK:
> > -
> > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> >  			break; /* So gcc recognizes the dead code. */
> 
> GCC's new __builtin_unreachable would help here, though obviously we
> can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> let us use it when available though.

So at some time when we can count on gcc 4.5 or newer, the code
would look something like the following?

	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
		this_is_unreachable();

I suppose that in the meantime one could supply the code to use
in the unreachable case:

	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
		this_is_unreachable(break);

But this is beginning to seem a bit strained to me.  ;-)

							Thanx, Paul

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-16 14:23     ` Paul E. McKenney
@ 2010-04-16 21:16       ` Josh Triplett
  2010-04-16 22:29         ` Paul E. McKenney
  0 siblings, 1 reply; 31+ messages in thread
From: Josh Triplett @ 2010-04-16 21:16 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > 
> > > cleanup: make dead code really dead
> > > 
> > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > ---
> > >  kernel/rcutree.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > index e54c123..6042fb8 100644
> > > --- a/kernel/rcutree.c
> > > +++ b/kernel/rcutree.c
> > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > >  		break; /* grace period idle or initializing, ignore. */
> > >  
> > >  	case RCU_SAVE_DYNTICK:
> > > -
> > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > >  			break; /* So gcc recognizes the dead code. */
> > 
> > GCC's new __builtin_unreachable would help here, though obviously we
> > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > let us use it when available though.
> 
> So at some time when we can count on gcc 4.5 or newer, the code
> would look something like the following?
> 
> 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> 		this_is_unreachable();

Yes, exactly.

> I suppose that in the meantime one could supply the code to use
> in the unreachable case:
> 
> 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> 		this_is_unreachable(break);
> 
> But this is beginning to seem a bit strained to me.  ;-)

I'd suggest spelling that this way:

	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
		unreachable();
		break;
	}

But in any case, all of these do seem excessive just to avoid the need
for an ifdef. :)

- Josh Triplett

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-16 21:16       ` Josh Triplett
@ 2010-04-16 22:29         ` Paul E. McKenney
  2010-04-17  4:53           ` Josh Triplett
  0 siblings, 1 reply; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-16 22:29 UTC (permalink / raw)
  To: Josh Triplett
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > 
> > > > cleanup: make dead code really dead
> > > > 
> > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > ---
> > > >  kernel/rcutree.c |    4 ++--
> > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > index e54c123..6042fb8 100644
> > > > --- a/kernel/rcutree.c
> > > > +++ b/kernel/rcutree.c
> > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > >  		break; /* grace period idle or initializing, ignore. */
> > > >  
> > > >  	case RCU_SAVE_DYNTICK:
> > > > -
> > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > >  			break; /* So gcc recognizes the dead code. */
> > > 
> > > GCC's new __builtin_unreachable would help here, though obviously we
> > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > let us use it when available though.
> > 
> > So at some time when we can count on gcc 4.5 or newer, the code
> > would look something like the following?
> > 
> > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > 		this_is_unreachable();
> 
> Yes, exactly.
> 
> > I suppose that in the meantime one could supply the code to use
> > in the unreachable case:
> > 
> > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > 		this_is_unreachable(break);
> > 
> > But this is beginning to seem a bit strained to me.  ;-)
> 
> I'd suggest spelling that this way:
> 
> 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> 		unreachable();
> 		break;
> 	}
> 
> But in any case, all of these do seem excessive just to avoid the need
> for an ifdef. :)

Actually, the "if" condition is a comparison of numerical constants,
so no #ifdef is required.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-16 22:29         ` Paul E. McKenney
@ 2010-04-17  4:53           ` Josh Triplett
  2010-04-18  1:12             ` Paul E. McKenney
  0 siblings, 1 reply; 31+ messages in thread
From: Josh Triplett @ 2010-04-17  4:53 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > 
> > > > > cleanup: make dead code really dead
> > > > > 
> > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > ---
> > > > >  kernel/rcutree.c |    4 ++--
> > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > index e54c123..6042fb8 100644
> > > > > --- a/kernel/rcutree.c
> > > > > +++ b/kernel/rcutree.c
> > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > >  
> > > > >  	case RCU_SAVE_DYNTICK:
> > > > > -
> > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > >  			break; /* So gcc recognizes the dead code. */
> > > > 
> > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > let us use it when available though.
> > > 
> > > So at some time when we can count on gcc 4.5 or newer, the code
> > > would look something like the following?
> > > 
> > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > 		this_is_unreachable();
> > 
> > Yes, exactly.
> > 
> > > I suppose that in the meantime one could supply the code to use
> > > in the unreachable case:
> > > 
> > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > 		this_is_unreachable(break);
> > > 
> > > But this is beginning to seem a bit strained to me.  ;-)
> > 
> > I'd suggest spelling that this way:
> > 
> > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > 		unreachable();
> > 		break;
> > 	}
> > 
> > But in any case, all of these do seem excessive just to avoid the need
> > for an ifdef. :)
> 
> Actually, the "if" condition is a comparison of numerical constants,
> so no #ifdef is required.

I just meant that those constants get #defined based on CONFIG_NO_HZ, so
an #ifdef on that would remove the need for the special handling of dead
code.

- Josh Triplett

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-17  4:53           ` Josh Triplett
@ 2010-04-18  1:12             ` Paul E. McKenney
  2010-04-18  3:53               ` Josh Triplett
  0 siblings, 1 reply; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-18  1:12 UTC (permalink / raw)
  To: Josh Triplett
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Fri, Apr 16, 2010 at 09:53:27PM -0700, Josh Triplett wrote:
> On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> > On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > 
> > > > > > cleanup: make dead code really dead
> > > > > > 
> > > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > > ---
> > > > > >  kernel/rcutree.c |    4 ++--
> > > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > > index e54c123..6042fb8 100644
> > > > > > --- a/kernel/rcutree.c
> > > > > > +++ b/kernel/rcutree.c
> > > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > > >  
> > > > > >  	case RCU_SAVE_DYNTICK:
> > > > > > -
> > > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > > >  			break; /* So gcc recognizes the dead code. */
> > > > > 
> > > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > > let us use it when available though.
> > > > 
> > > > So at some time when we can count on gcc 4.5 or newer, the code
> > > > would look something like the following?
> > > > 
> > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > 		this_is_unreachable();
> > > 
> > > Yes, exactly.
> > > 
> > > > I suppose that in the meantime one could supply the code to use
> > > > in the unreachable case:
> > > > 
> > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > 		this_is_unreachable(break);
> > > > 
> > > > But this is beginning to seem a bit strained to me.  ;-)
> > > 
> > > I'd suggest spelling that this way:
> > > 
> > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > > 		unreachable();
> > > 		break;
> > > 	}
> > > 
> > > But in any case, all of these do seem excessive just to avoid the need
> > > for an ifdef. :)
> > 
> > Actually, the "if" condition is a comparison of numerical constants,
> > so no #ifdef is required.
> 
> I just meant that those constants get #defined based on CONFIG_NO_HZ, so
> an #ifdef on that would remove the need for the special handling of dead
> code.

True, I could put a #ifdef CONFIG_NO_HZ around that leg of the switch
statement.  Or am I still missing your point?

							Thanx, Paul

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-18  1:12             ` Paul E. McKenney
@ 2010-04-18  3:53               ` Josh Triplett
  2010-04-18 13:42                 ` Paul E. McKenney
  0 siblings, 1 reply; 31+ messages in thread
From: Josh Triplett @ 2010-04-18  3:53 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Sat, Apr 17, 2010 at 06:12:13PM -0700, Paul E. McKenney wrote:
> On Fri, Apr 16, 2010 at 09:53:27PM -0700, Josh Triplett wrote:
> > On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> > > On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > > > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > 
> > > > > > > cleanup: make dead code really dead
> > > > > > > 
> > > > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > > > ---
> > > > > > >  kernel/rcutree.c |    4 ++--
> > > > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > > > index e54c123..6042fb8 100644
> > > > > > > --- a/kernel/rcutree.c
> > > > > > > +++ b/kernel/rcutree.c
> > > > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > > > >  
> > > > > > >  	case RCU_SAVE_DYNTICK:
> > > > > > > -
> > > > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > > > >  			break; /* So gcc recognizes the dead code. */
> > > > > > 
> > > > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > > > let us use it when available though.
> > > > > 
> > > > > So at some time when we can count on gcc 4.5 or newer, the code
> > > > > would look something like the following?
> > > > > 
> > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > 		this_is_unreachable();
> > > > 
> > > > Yes, exactly.
> > > > 
> > > > > I suppose that in the meantime one could supply the code to use
> > > > > in the unreachable case:
> > > > > 
> > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > 		this_is_unreachable(break);
> > > > > 
> > > > > But this is beginning to seem a bit strained to me.  ;-)
> > > > 
> > > > I'd suggest spelling that this way:
> > > > 
> > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > > > 		unreachable();
> > > > 		break;
> > > > 	}
> > > > 
> > > > But in any case, all of these do seem excessive just to avoid the need
> > > > for an ifdef. :)
> > > 
> > > Actually, the "if" condition is a comparison of numerical constants,
> > > so no #ifdef is required.
> > 
> > I just meant that those constants get #defined based on CONFIG_NO_HZ, so
> > an #ifdef on that would remove the need for the special handling of dead
> > code.
> 
> True, I could put a #ifdef CONFIG_NO_HZ around that leg of the switch
> statement.  Or am I still missing your point?

No, you got it exactly.  Hence my suggesting that all the other
alternatives (the if with a break, or with __builtin_unreachable) seemed
excessive just to try to convince the compiler to infer what an ifdef
would tell it explicitly. :)

- Josh Triplett

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-18  3:53               ` Josh Triplett
@ 2010-04-18 13:42                 ` Paul E. McKenney
  2010-04-18 21:12                   ` Josh Triplett
  0 siblings, 1 reply; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-18 13:42 UTC (permalink / raw)
  To: Josh Triplett
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Sat, Apr 17, 2010 at 08:53:09PM -0700, Josh Triplett wrote:
> On Sat, Apr 17, 2010 at 06:12:13PM -0700, Paul E. McKenney wrote:
> > On Fri, Apr 16, 2010 at 09:53:27PM -0700, Josh Triplett wrote:
> > > On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> > > > On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > > > > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > > > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > > 
> > > > > > > > cleanup: make dead code really dead
> > > > > > > > 
> > > > > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > > > > ---
> > > > > > > >  kernel/rcutree.c |    4 ++--
> > > > > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > > > 
> > > > > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > > > > index e54c123..6042fb8 100644
> > > > > > > > --- a/kernel/rcutree.c
> > > > > > > > +++ b/kernel/rcutree.c
> > > > > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > > > > >  
> > > > > > > >  	case RCU_SAVE_DYNTICK:
> > > > > > > > -
> > > > > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > > > > >  			break; /* So gcc recognizes the dead code. */
> > > > > > > 
> > > > > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > > > > let us use it when available though.
> > > > > > 
> > > > > > So at some time when we can count on gcc 4.5 or newer, the code
> > > > > > would look something like the following?
> > > > > > 
> > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > > 		this_is_unreachable();
> > > > > 
> > > > > Yes, exactly.
> > > > > 
> > > > > > I suppose that in the meantime one could supply the code to use
> > > > > > in the unreachable case:
> > > > > > 
> > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > > 		this_is_unreachable(break);
> > > > > > 
> > > > > > But this is beginning to seem a bit strained to me.  ;-)
> > > > > 
> > > > > I'd suggest spelling that this way:
> > > > > 
> > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > > > > 		unreachable();
> > > > > 		break;
> > > > > 	}
> > > > > 
> > > > > But in any case, all of these do seem excessive just to avoid the need
> > > > > for an ifdef. :)
> > > > 
> > > > Actually, the "if" condition is a comparison of numerical constants,
> > > > so no #ifdef is required.
> > > 
> > > I just meant that those constants get #defined based on CONFIG_NO_HZ, so
> > > an #ifdef on that would remove the need for the special handling of dead
> > > code.
> > 
> > True, I could put a #ifdef CONFIG_NO_HZ around that leg of the switch
> > statement.  Or am I still missing your point?
> 
> No, you got it exactly.  Hence my suggesting that all the other
> alternatives (the if with a break, or with __builtin_unreachable) seemed
> excessive just to try to convince the compiler to infer what an ifdef
> would tell it explicitly. :)

Which is exactly the purpose of the "if" statement comparing the two
constants, right?  ;-)

							Thanx, Paul

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-18 13:42                 ` Paul E. McKenney
@ 2010-04-18 21:12                   ` Josh Triplett
  2010-04-18 21:54                     ` Paul E. McKenney
  0 siblings, 1 reply; 31+ messages in thread
From: Josh Triplett @ 2010-04-18 21:12 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

On Sun, Apr 18, 2010 at 06:42:17AM -0700, Paul E. McKenney wrote:
> On Sat, Apr 17, 2010 at 08:53:09PM -0700, Josh Triplett wrote:
> > On Sat, Apr 17, 2010 at 06:12:13PM -0700, Paul E. McKenney wrote:
> > > On Fri, Apr 16, 2010 at 09:53:27PM -0700, Josh Triplett wrote:
> > > > On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> > > > > On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > > > > > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > > > > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > > > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > > > 
> > > > > > > > > cleanup: make dead code really dead
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > > > > > ---
> > > > > > > > >  kernel/rcutree.c |    4 ++--
> > > > > > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > > > > 
> > > > > > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > > > > > index e54c123..6042fb8 100644
> > > > > > > > > --- a/kernel/rcutree.c
> > > > > > > > > +++ b/kernel/rcutree.c
> > > > > > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > > > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > > > > > >  
> > > > > > > > >  	case RCU_SAVE_DYNTICK:
> > > > > > > > > -
> > > > > > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > > > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > > > > > >  			break; /* So gcc recognizes the dead code. */
> > > > > > > > 
> > > > > > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > > > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > > > > > let us use it when available though.
> > > > > > > 
> > > > > > > So at some time when we can count on gcc 4.5 or newer, the code
> > > > > > > would look something like the following?
> > > > > > > 
> > > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > > > 		this_is_unreachable();
> > > > > > 
> > > > > > Yes, exactly.
> > > > > > 
> > > > > > > I suppose that in the meantime one could supply the code to use
> > > > > > > in the unreachable case:
> > > > > > > 
> > > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > > > 		this_is_unreachable(break);
> > > > > > > 
> > > > > > > But this is beginning to seem a bit strained to me.  ;-)
> > > > > > 
> > > > > > I'd suggest spelling that this way:
> > > > > > 
> > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > > > > > 		unreachable();
> > > > > > 		break;
> > > > > > 	}
> > > > > > 
> > > > > > But in any case, all of these do seem excessive just to avoid the need
> > > > > > for an ifdef. :)
> > > > > 
> > > > > Actually, the "if" condition is a comparison of numerical constants,
> > > > > so no #ifdef is required.
> > > > 
> > > > I just meant that those constants get #defined based on CONFIG_NO_HZ, so
> > > > an #ifdef on that would remove the need for the special handling of dead
> > > > code.
> > > 
> > > True, I could put a #ifdef CONFIG_NO_HZ around that leg of the switch
> > > statement.  Or am I still missing your point?
> > 
> > No, you got it exactly.  Hence my suggesting that all the other
> > alternatives (the if with a break, or with __builtin_unreachable) seemed
> > excessive just to try to convince the compiler to infer what an ifdef
> > would tell it explicitly. :)
> 
> Which is exactly the purpose of the "if" statement comparing the two
> constants, right?  ;-)

Right, which also seems excessive compared to an ifdef, since it serves
the same purpose but more confusingly. ;)

- Josh Triplett

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
  2010-04-18 21:12                   ` Josh Triplett
@ 2010-04-18 21:54                     ` Paul E. McKenney
  0 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-18 21:54 UTC (permalink / raw)
  To: Josh Triplett
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	eric.dumazet

oN Sun, Apr 18, 2010 at 02:12:16PM -0700, Josh Triplett wrote:
> On Sun, Apr 18, 2010 at 06:42:17AM -0700, Paul E. McKenney wrote:
> > On Sat, Apr 17, 2010 at 08:53:09PM -0700, Josh Triplett wrote:
> > > On Sat, Apr 17, 2010 at 06:12:13PM -0700, Paul E. McKenney wrote:
> > > > On Fri, Apr 16, 2010 at 09:53:27PM -0700, Josh Triplett wrote:
> > > > > On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> > > > > > On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > > > > > > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > > > > > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > > > > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > > > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > > > > 
> > > > > > > > > > cleanup: make dead code really dead
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > > > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > > > > > > ---
> > > > > > > > > >  kernel/rcutree.c |    4 ++--
> > > > > > > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > > > > > > 
> > > > > > > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > > > > > > index e54c123..6042fb8 100644
> > > > > > > > > > --- a/kernel/rcutree.c
> > > > > > > > > > +++ b/kernel/rcutree.c
> > > > > > > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > > > > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > > > > > > >  
> > > > > > > > > >  	case RCU_SAVE_DYNTICK:
> > > > > > > > > > -
> > > > > > > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > > > > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > > > > > > >  			break; /* So gcc recognizes the dead code. */
> > > > > > > > > 
> > > > > > > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > > > > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > > > > > > let us use it when available though.
> > > > > > > > 
> > > > > > > > So at some time when we can count on gcc 4.5 or newer, the code
> > > > > > > > would look something like the following?
> > > > > > > > 
> > > > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > > > > 		this_is_unreachable();
> > > > > > > 
> > > > > > > Yes, exactly.
> > > > > > > 
> > > > > > > > I suppose that in the meantime one could supply the code to use
> > > > > > > > in the unreachable case:
> > > > > > > > 
> > > > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > > > > > > 		this_is_unreachable(break);
> > > > > > > > 
> > > > > > > > But this is beginning to seem a bit strained to me.  ;-)
> > > > > > > 
> > > > > > > I'd suggest spelling that this way:
> > > > > > > 
> > > > > > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > > > > > > 		unreachable();
> > > > > > > 		break;
> > > > > > > 	}
> > > > > > > 
> > > > > > > But in any case, all of these do seem excessive just to avoid the need
> > > > > > > for an ifdef. :)
> > > > > > 
> > > > > > Actually, the "if" condition is a comparison of numerical constants,
> > > > > > so no #ifdef is required.
> > > > > 
> > > > > I just meant that those constants get #defined based on CONFIG_NO_HZ, so
> > > > > an #ifdef on that would remove the need for the special handling of dead
> > > > > code.
> > > > 
> > > > True, I could put a #ifdef CONFIG_NO_HZ around that leg of the switch
> > > > statement.  Or am I still missing your point?
> > > 
> > > No, you got it exactly.  Hence my suggesting that all the other
> > > alternatives (the if with a break, or with __builtin_unreachable) seemed
> > > excessive just to try to convince the compiler to infer what an ifdef
> > > would tell it explicitly. :)
> > 
> > Which is exactly the purpose of the "if" statement comparing the two
> > constants, right?  ;-)
> 
> Right, which also seems excessive compared to an ifdef, since it serves
> the same purpose but more confusingly. ;)

Well, I must confess that it confused me when I added the spin_unlock()...

							Thanx, Paul

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (15 preceding siblings ...)
  2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 16/16] rcu: v2: reduce the number of spurious RCU_SOFTIRQ invocations Paul E. McKenney
@ 2010-04-20 10:11 ` David Howells
  2010-04-20 15:05   ` Paul E. McKenney
  2010-04-20 10:15 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends David Howells
  17 siblings, 1 reply; 31+ messages in thread
From: David Howells @ 2010-04-20 10:11 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: dhowells, linux-kernel, mingo, laijs, dipankar, akpm,
	mathieu.desnoyers, josh, dvhltc, niv, tglx, peterz, rostedt,
	Valdis.Kletnieks, eric.dumazet


Does it make sense for synchronize_sched() to be inline too?  Since that's
just a wrapper around cond_resched(), which is normally just a wrapper around
_cond_resched().

Otherwise:

Acked-by: David Howells <dhowells@redhat.com>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends
  2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
                   ` (16 preceding siblings ...)
  2010-04-20 10:11 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline David Howells
@ 2010-04-20 10:15 ` David Howells
  2010-04-20 19:18   ` Paul E. McKenney
  17 siblings, 1 reply; 31+ messages in thread
From: David Howells @ 2010-04-20 10:15 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: dhowells, linux-kernel, mingo, laijs, dipankar, akpm,
	mathieu.desnoyers, josh, dvhltc, niv, tglx, peterz, rostedt,
	Valdis.Kletnieks, eric.dumazet

Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> +void rcu_scheduler_starting(void)
> +{
> +	WARN_ON(nr_context_switches() > 0);
> +	rcu_scheduler_active = 1;
> +}

Since rcu_scheduler_active is a global variable, does it make sense to make
this an inline function in the header file?

It looks decidedly odd in its own include file as you've done it.  Wouldn't
the right way to do this be to split it into its own .c file and conditionally
compile it in the Makefile?

David

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline
  2010-04-20 10:11 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline David Howells
@ 2010-04-20 15:05   ` Paul E. McKenney
  0 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-20 15:05 UTC (permalink / raw)
  To: David Howells
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	josh, dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks,
	eric.dumazet

On Tue, Apr 20, 2010 at 11:11:06AM +0100, David Howells wrote:
> 
> Does it make sense for synchronize_sched() to be inline too?  Since that's
> just a wrapper around cond_resched(), which is normally just a wrapper around
> _cond_resched().

I tried that, and quickly descended into #include hell.  :-(

							Thanx, Paul

> Otherwise:
> 
> Acked-by: David Howells <dhowells@redhat.com>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends
  2010-04-20 10:15 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends David Howells
@ 2010-04-20 19:18   ` Paul E. McKenney
  0 siblings, 0 replies; 31+ messages in thread
From: Paul E. McKenney @ 2010-04-20 19:18 UTC (permalink / raw)
  To: David Howells
  Cc: linux-kernel, mingo, laijs, dipankar, akpm, mathieu.desnoyers,
	josh, dvhltc, niv, tglx, peterz, rostedt, Valdis.Kletnieks,
	eric.dumazet

On Tue, Apr 20, 2010 at 11:15:08AM +0100, David Howells wrote:
> Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> 
> > +void rcu_scheduler_starting(void)
> > +{
> > +	WARN_ON(nr_context_switches() > 0);
> > +	rcu_scheduler_active = 1;
> > +}
> 
> Since rcu_scheduler_active is a global variable, does it make sense to make
> this an inline function in the header file?

Unfortunately, nr_context_switches() put me in #include hell when I
tried that.

> It looks decidedly odd in its own include file as you've done it.  Wouldn't
> the right way to do this be to split it into its own .c file and conditionally
> compile it in the Makefile?

It will soon have lots of company, as this is where the plugins
for CONFIG_TINY_PREEMPT_RCU will go.  In other words, kernel/rcutiny.c
will have the same relationship to kernel/rcutiny_plugin.h that
kernel/rcutree.c has with kernel/rcutree_plugin.h.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2010-04-20 19:18 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_resched for sending resched IPIs Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead Paul E. McKenney
2010-04-15 23:52   ` Josh Triplett
2010-04-16 14:23     ` Paul E. McKenney
2010-04-16 21:16       ` Josh Triplett
2010-04-16 22:29         ` Paul E. McKenney
2010-04-17  4:53           ` Josh Triplett
2010-04-18  1:12             ` Paul E. McKenney
2010-04-18  3:53               ` Josh Triplett
2010-04-18 13:42                 ` Paul E. McKenney
2010-04-18 21:12                   ` Josh Triplett
2010-04-18 21:54                     ` Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 03/16] rcu: move some code from macro to function Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 04/16] rcu: ignore offline CPUs in last non-dyntick-idle CPU check Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 05/16] rcu: Fix bogus CONFIG_PROVE_LOCKING in comments to reflect reality Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 06/16] rcu: fix now-bogus rcu_scheduler_active comments Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 08/16] rcu: rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 09/16] rcu: refactor RCU's context-switch handling Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 11/16] rcu: enable CPU_STALL_VERBOSE by default Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 12/16] rcu: disable CPU stall warnings upon panic Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 13/16] rcu: print boot-time console messages if RCU configs out of ordinary Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 14/16] rcu: improve RCU CPU stall-warning messages Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 15/16] rcu: permit discontiguous cpu_possible_mask CPU numbering Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 16/16] rcu: v2: reduce the number of spurious RCU_SOFTIRQ invocations Paul E. McKenney
2010-04-20 10:11 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline David Howells
2010-04-20 15:05   ` Paul E. McKenney
2010-04-20 10:15 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends David Howells
2010-04-20 19:18   ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.