Skip to contentSkip to conversation

v2 Tiny RCU changes for 3.9

PATCH In review Paul E. McKenney 2 participants 7 messages Jan 27, 2013 – Jan 29, 2013 Library code

lore
Share & tools
lore
#2 lore raw

PATCH 2/2 rcu: Allow TREE_PREEMPT_RCU on UP systems

In reply to Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

The TINY_PREEMPT_RCU is complex, does not provide that much memory savings, and therefore TREE_PREEMPT_RCU should be used instead. The systems where the difference between TINY_PREEMPT_RCU and TREE_PREEMPT_RCU are quite small compared to the memory footprint of CONFIG_PREEMPT.

This commit therefore takes a first step towards eliminating TINY_PREEMPT_RCU by allowing TREE_PREEMPT_RCU to be configured on !SMP systems.

---
 init/Kconfig |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
init/Kconfig +3 -1
index a5e90e1..fb19b46 100644
@@ -453,7 +453,7 @@ config TREE_RCU
 
 config TREE_PREEMPT_RCU
 	bool "Preemptible tree-based hierarchical RCU"
-	depends on PREEMPT && SMP
+	depends on PREEMPT
 	help
 	  This option selects the RCU implementation that is
 	  designed for very large SMP systems with hundreds or
@@ -461,6 +461,8 @@ config TREE_PREEMPT_RCU
 	  is also required.  It also scales down nicely to
 	  smaller systems.
 
+	  Select this option if you are unsure.
+
 config TINY_RCU
 	bool "UP-only small-memory-footprint RCU"
 	depends on !PREEMPT && !SMP
Signature · 1 line
1.7.8
#0 lore raw

cover v2 Tiny RCU changes for 3.9

Hello!

This series provides a couple of tiny-RCU changes:

1. Make Tiny RCU emit RCU CPU stall warnings when RCU_TRACE=y.
2. Allow TREE_PREEMPT_RCU to be used on UP systems.

Changes since v1:

o Updated #1 as suggested by Josh Triplett to simplify the

	#if expressions.

o Added #2.

Thanx, Paul

 b/init/Kconfig            |   12 +++++++++
 b/kernel/rcu.h            |    7 +++++
 b/kernel/rcupdate.c       |   51 +++++++++++++++++++++++++++++++++++++++++
 b/kernel/rcutiny.c        |    6 +++-
 b/kernel/rcutiny_plugin.h |   56 ++++++++++++++++++++++++++++++++++++++++++++++
 b/kernel/rcutree.c        |   46 ++-----------------------------------
 b/kernel/rcutree.h        |    5 ----
 b/lib/Kconfig.debug       |    2 -
 8 files changed, 133 insertions(+), 52 deletions(-)
#1 lore raw

PATCH 1/2 rcu: Provide RCU CPU stall warnings for tiny RCU

From: "Paul E. McKenney" <[email protected]>

Tiny RCU has historically omitted RCU CPU stall warnings in order to reduce memory requirements, however, lack of these warnings caused Thomas Gleixner some debugging pain recently. Therefore, this commit adds RCU CPU stall warnings to tiny RCU if RCU_TRACE=y. This keeps the memory footprint small, while still enabling CPU stall warnings in kernels built to enable them.

Updated to include Josh Triplett's suggested use of RCU_STALL_COMMON config variable to simplify #if expressions.

---
 init/Kconfig            |    8 ++++++
 kernel/rcu.h            |    7 ++++++
 kernel/rcupdate.c       |   51 ++++++++++++++++++++++++++++++++++++++++++
 kernel/rcutiny.c        |    6 +++-
 kernel/rcutiny_plugin.h |   56 +++++++++++++++++++++++++++++++++++++++++++++++
 kernel/rcutree.c        |   46 ++------------------------------------
 kernel/rcutree.h        |    5 ----
 lib/Kconfig.debug       |    2 +-
 8 files changed, 130 insertions(+), 51 deletions(-)
init/Kconfig +8 -0
index 7d30240..a5e90e1 100644
@@ -486,6 +486,14 @@ config PREEMPT_RCU
 	  This option enables preemptible-RCU code that is common between
 	  the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
 
+config RCU_STALL_COMMON
+	def_bool ( TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE )
+	help
+	  This option enables RCU CPU stall code that is common between
+	  the TINY and TREE variants of RCU.  The purpose is to allow
+	  the tiny variants to disable RCU CPU stall warnings, while
+	  making these warnings mandatory for the tree variants.
+
 config CONTEXT_TRACKING
        bool
 
kernel/rcu.h +7 -0
index 20dfba5..7f8e759 100644
@@ -111,4 +111,11 @@ static inline bool __rcu_reclaim(char *rn, struct rcu_head *head)
 
 extern int rcu_expedited;
 
+#ifdef CONFIG_RCU_STALL_COMMON
+
+extern int rcu_cpu_stall_suppress;
+int rcu_jiffies_till_stall_check(void);
+
+#endif /* #ifdef CONFIG_RCU_STALL_COMMON */
+
 #endif /* __LINUX_RCU_H */
kernel/rcupdate.c +51 -0

54 lines not on this page · raw message

kernel/rcutiny.c +4 -2
index e7dce58..b899df3 100644
@@ -51,10 +51,10 @@ static void __call_rcu(struct rcu_head *head,
 		       void (*func)(struct rcu_head *rcu),
 		       struct rcu_ctrlblk *rcp);
 
-#include "rcutiny_plugin.h"
-
 static long long rcu_dynticks_nesting = DYNTICK_TASK_EXIT_IDLE;
 
+#include "rcutiny_plugin.h"
+
 /* Common code for rcu_idle_enter() and rcu_irq_exit(), see kernel/rcutree.c. */
 static void rcu_idle_enter_common(long long newval)
 {
@@ -205,6 +205,7 @@ int rcu_is_cpu_rrupt_from_idle(void)
  */
 static int rcu_qsctr_help(struct rcu_ctrlblk *rcp)
 {
+	reset_cpu_stall_ticks(rcp);
 	if (rcp->rcucblist != NULL &&
 	    rcp->donetail != rcp->curtail) {
 		rcp->donetail = rcp->curtail;
@@ -251,6 +252,7 @@ void rcu_bh_qs(int cpu)
  */
 void rcu_check_callbacks(int cpu, int user)
 {
+	check_cpu_stalls();
 	if (user || rcu_is_cpu_rrupt_from_idle())
 		rcu_sched_qs(cpu);
 	else if (!in_softirq())
kernel/rcutiny_plugin.h +56 -0

78 lines not on this page · raw message

kernel/rcutree.c +3 -43

91 lines not on this page · raw message

kernel/rcutree.h +0 -5
index 4b69291..db9bec8 100644
@@ -343,11 +343,6 @@ struct rcu_data {
 
 #define RCU_JIFFIES_TILL_FORCE_QS	 3	/* for rsp->jiffies_force_qs */
 
-#ifdef CONFIG_PROVE_RCU
-#define RCU_STALL_DELAY_DELTA	       (5 * HZ)
-#else
-#define RCU_STALL_DELAY_DELTA	       0
-#endif
 #define RCU_STALL_RAT_DELAY		2	/* Allow other CPUs time */
 						/*  to take at least one */
 						/*  scheduling clock irq */
lib/Kconfig.debug +1 -1
index 3a35309..a40a36b 100644
@@ -970,7 +970,7 @@ config RCU_TORTURE_TEST_RUNNABLE
 
 config RCU_CPU_STALL_TIMEOUT
 	int "RCU CPU stall timeout in seconds"
-	depends on TREE_RCU || TREE_PREEMPT_RCU
+	depends on TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE
 	range 3 300
 	default 21
 	help
Signature · 1 line
1.7.8
Reviewed-by on v1 1/2
#4 lore raw

Re: [PATCH tip/core/rcu 1/2] rcu: Provide RCU CPU stall warnings for tiny RCU

Quoted 9 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

Tiny RCU has historically omitted RCU CPU stall warnings in order to reduce memory requirements, however, lack of these warnings caused Thomas Gleixner some debugging pain recently. Therefore, this commit adds RCU CPU stall warnings to tiny RCU if RCU_TRACE=y. This keeps the memory footprint small, while still enabling CPU stall warnings in kernels built to enable them.

Quoted 6 lines

Updated to include Josh Triplett's suggested use of RCU_STALL_COMMON config variable to simplify #if expressions.

One suggestion below; with that change,

Quoted 14 lines
init/Kconfig +8 -0
@@ -486,6 +486,14 @@ config PREEMPT_RCU
 	  This option enables preemptible-RCU code that is common between
 	  the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
 
+config RCU_STALL_COMMON
+	def_bool ( TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE )
+	help
+	  This option enables RCU CPU stall code that is common between
+	  the TINY and TREE variants of RCU.  The purpose is to allow
+	  the tiny variants to disable RCU CPU stall warnings, while
+	  making these warnings mandatory for the tree variants.
+

[...]

lib/Kconfig.debug config RCU_TORTURE_TEST_RUNNABLE · line 973

Quoted 8 lines
lib/Kconfig.debug +1 -1
@@ -970,7 +970,7 @@ config RCU_TORTURE_TEST_RUNNABLE
 
 config RCU_CPU_STALL_TIMEOUT
 	int "RCU CPU stall timeout in seconds"
-	depends on TREE_RCU || TREE_PREEMPT_RCU
+	depends on TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE

depends on RCU_STALL_COMMON

Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH tip/core/rcu 2/2] rcu: Allow TREE_PREEMPT_RCU on UP systems

In reply to Paul E. McKenney
Quoted 7 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

The TINY_PREEMPT_RCU is complex, does not provide that much memory savings, and therefore TREE_PREEMPT_RCU should be used instead. The systems where the difference between TINY_PREEMPT_RCU and TREE_PREEMPT_RCU are quite small compared to the memory footprint of CONFIG_PREEMPT.

Quoted 5 lines

This commit therefore takes a first step towards eliminating TINY_PREEMPT_RCU by allowing TREE_PREEMPT_RCU to be configured on !SMP systems.

Quoted 29 lines
---
 init/Kconfig |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
init/Kconfig +3 -1
index a5e90e1..fb19b46 100644
@@ -453,7 +453,7 @@ config TREE_RCU
 
 config TREE_PREEMPT_RCU
 	bool "Preemptible tree-based hierarchical RCU"
-	depends on PREEMPT && SMP
+	depends on PREEMPT
 	help
 	  This option selects the RCU implementation that is
 	  designed for very large SMP systems with hundreds or
@@ -461,6 +461,8 @@ config TREE_PREEMPT_RCU
 	  is also required.  It also scales down nicely to
 	  smaller systems.
 
+	  Select this option if you are unsure.
+
 config TINY_RCU
 	bool "UP-only small-memory-footprint RCU"
 	depends on !PREEMPT && !SMP
Signature · 1 line
1.7.8
Reviewed-by on the v1 series
#6 lore raw
In reply to Paul E. McKenney
Quoted 6 lines · Paul E. McKenney

Hello!

This series provides a couple of tiny-RCU changes:

1. Make Tiny RCU emit RCU CPU stall warnings when RCU_TRACE=y.
2. Allow TREE_PREEMPT_RCU to be used on UP systems.

I replied to patch 1 with a suggestion; with that change,

for the whole series.

- Josh Triplett

#5 lore raw

Re: [PATCH tip/core/rcu 1/2] rcu: Provide RCU CPU stall warnings for tiny RCU

In reply to Josh Triplett
Quoted 39 lines · Josh Triplett
Quoted 9 lines · Paul E. McKenney

From: "Paul E. McKenney" <[email protected]>

Tiny RCU has historically omitted RCU CPU stall warnings in order to reduce memory requirements, however, lack of these warnings caused Thomas Gleixner some debugging pain recently. Therefore, this commit adds RCU CPU stall warnings to tiny RCU if RCU_TRACE=y. This keeps the memory footprint small, while still enabling CPU stall warnings in kernels built to enable them.

Quoted 6 lines

Updated to include Josh Triplett's suggested use of RCU_STALL_COMMON config variable to simplify #if expressions.

One suggestion below; with that change,

Quoted 14 lines
init/Kconfig +8 -0
@@ -486,6 +486,14 @@ config PREEMPT_RCU
 	  This option enables preemptible-RCU code that is common between
 	  the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
 
+config RCU_STALL_COMMON
+	def_bool ( TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE )
+	help
+	  This option enables RCU CPU stall code that is common between
+	  the TINY and TREE variants of RCU.  The purpose is to allow
+	  the tiny variants to disable RCU CPU stall warnings, while
+	  making these warnings mandatory for the tree variants.
+

[...]

Quoted 4 lines
lib/Kconfig.debug +0 -0
@@ -970,7 +970,7 @@ config RCU_TORTURE_TEST_RUNNABLE
 
Quoted 6 lines

lib/Kconfig.debug config RCU_TORTURE_TEST_RUNNABLE · line 973

Quoted 4 lines
lib/Kconfig.debug +1 -1
 config RCU_CPU_STALL_TIMEOUT
 	int "RCU CPU stall timeout in seconds"
-	depends on TREE_RCU || TREE_PREEMPT_RCU
+	depends on TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE

depends on RCU_STALL_COMMON

Good catch, fixed!

Thanx, Paul