Skip to contentSkip to conversation

TINY_RCU changes for 3.11

PATCH In review Paul E. McKenney 2 participants 16 messages Apr 12, 2013 – Apr 13, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover TINY_RCU changes for 3.11

Hello!

This series removes TINY_PREEMPT_RCU, as promised/threatened at
http://lwn.net/Articles/541037/ and https://lkml.org/lkml/2012/11/12/545.

1. Remove TINY_PREEMPT_RCU. This is a straight syntactic removal,
with no attempt at cleanup. The remaining patches do the cleanup.

2. Inline the now-empty show_tiny_preempt_stats() function.

3. Inline the now-empty rcu_preempt_check_callbacks() function.

4. Inline the now-empty rcu_preempt_remove_callbacks() function.

5. Inline the now-empty rcu_preempt_process_callbacks() function.

6. Because TINY_RCU no longer has kthreads, remove the code that
used to abstract away kthread vs. softirq invocation.

7. Inline the now-empty check_cpu_stall_preempt() function.

8. Remove CONFIG_TINY_RCU ifdefs from include/linux/rcutiny.h

9. Inline the now-empty rcu_preempt_note_context_switch() function.

10. Move code to allow consolidating ifdefs in kernel/rcutiny_plugin.h.

11. Remove TINY_PREEMPT_RCU's tracing formats from documentation.

12. Shrink TINY_RCU a bit by moving exit_rcu() to TREE_RCU, leaving
TINY_RCU with a static inline empty function.

Thanx, Paul

 b/Documentation/RCU/trace.txt |  100 ----
 b/include/linux/hardirq.h     |    2 
 b/include/linux/rcupdate.h    |    5 
 b/include/linux/rcutiny.h     |   41 -
 b/include/linux/rcutree.h     |    3 
 b/init/Kconfig                |   10 
 b/kernel/rcupdate.c           |   26 -
 b/kernel/rcutiny.c            |   17 
 b/kernel/rcutiny_plugin.h     | 1017 +-----------------------------------------
 b/kernel/rcutree_plugin.h     |   26 +
 10 files changed, 90 insertions(+), 1157 deletions(-)
#1 lore raw

PATCH 1/12 rcu: Remove TINY_PREEMPT_RCU

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

TINY_PREEMPT_RCU adds significant code and complexity, but does not offer commensurate benefits. People currently using TINY_PREEMPT_RCU can get much better memory footprint with TINY_RCU, or, if they really need preemptible RCU, they can use TREE_PREEMPT_RCU with a relatively minor degradation in memory footprint. Please note that this move has been widely publicized on LKML (https://lkml.org/lkml/2012/11/12/545)
and on LWN (http://lwn.net/Articles/541037/).

This commit therefore removes TINY_PREEMPT_RCU.

---
 include/linux/hardirq.h  |   2 +-
 include/linux/rcupdate.h |   2 +-
 init/Kconfig             |  10 +-
 kernel/rcutiny_plugin.h  | 854 -----------------------------------------------
 4 files changed, 3 insertions(+), 865 deletions(-)
include/linux/hardirq.h +1 -1
index c1d6555..05bcc09 100644
@@ -128,7 +128,7 @@ extern void synchronize_irq(unsigned int irq);
 # define synchronize_irq(irq)	barrier()
 #endif
 
-#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
+#if defined(CONFIG_TINY_RCU)
 
 static inline void rcu_nmi_enter(void)
 {
include/linux/rcupdate.h +1 -1
index 9ed2c9a..0a8276d 100644
@@ -277,7 +277,7 @@ void wait_rcu_gp(call_rcu_func_t crf);
 
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
 #include <linux/rcutree.h>
-#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
+#elif defined(CONFIG_TINY_RCU)
 #include <linux/rcutiny.h>
 #else
 #error "Unknown RCU implementation specified to kernel configuration"
init/Kconfig +1 -9
index a3a2304..406b1a5 100644
@@ -462,18 +462,10 @@ config TINY_RCU
 	  is not required.  This option greatly reduces the
 	  memory footprint of RCU.
 
-config TINY_PREEMPT_RCU
-	bool "Preemptible UP-only small-memory-footprint RCU"
-	depends on PREEMPT && !SMP
-	help
-	  This option selects the RCU implementation that is designed
-	  for real-time UP systems.  This option greatly reduces the
-	  memory footprint of RCU.
-
 endchoice
 
 config PREEMPT_RCU
-	def_bool ( TREE_PREEMPT_RCU || TINY_PREEMPT_RCU )
+	def_bool TREE_PREEMPT_RCU
 	help
 	  This option enables preemptible-RCU code that is common between
 	  the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
kernel/rcutiny_plugin.h +0 -854

884 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/12 rcu: Remove show_tiny_preempt_stats()

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

With the removal of CONFIG_TINY_PREEMPT_RCU, show_tiny_preempt_stats() is now an empty function. This commit therefore eliminates it by inlining it.

---
 kernel/rcutiny_plugin.h | 13 -------------
 1 file changed, 13 deletions(-)
kernel/rcutiny_plugin.h +0 -13
index 29a4dd7..cf0bc22 100644
@@ -102,18 +102,6 @@ static void check_cpu_stalls(void)
 	RCU_TRACE(check_cpu_stall_preempt());
 }
 
-#ifdef CONFIG_RCU_TRACE
-
-/*
- * Because preemptible RCU does not exist, it is not necessary to
- * dump out its statistics.
- */
-static void show_tiny_preempt_stats(struct seq_file *m)
-{
-}
-
-#endif /* #ifdef CONFIG_RCU_TRACE */
-
 /*
  * Because preemptible RCU does not exist, it never has any callbacks
  * to check.
@@ -202,7 +190,6 @@ static void rcu_trace_sub_qlen(struct rcu_ctrlblk *rcp, int n)
  */
 static int show_tiny_stats(struct seq_file *m, void *unused)
 {
-	show_tiny_preempt_stats(m);
 	seq_printf(m, "rcu_sched: qlen: %ld\n", rcu_sched_ctrlblk.qlen);
 	seq_printf(m, "rcu_bh: qlen: %ld\n", rcu_bh_ctrlblk.qlen);
 	return 0;
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 3/12 rcu: Remove rcu_preempt_check_callbacks()

In reply to Paul E. McKenney

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

With the removal of CONFIG_TINY_PREEMPT_RCU, rcu_preempt_check_callbacks() is now an empty function. This commit therefore eliminates it by inlining it.

---
 kernel/rcutiny.c        | 1 -
 kernel/rcutiny_plugin.h | 8 --------
 2 files changed, 9 deletions(-)
kernel/rcutiny.c +0 -1
index a0714a5..9178282 100644
@@ -257,7 +257,6 @@ void rcu_check_callbacks(int cpu, int user)
 		rcu_sched_qs(cpu);
 	else if (!in_softirq())
 		rcu_bh_qs(cpu);
-	rcu_preempt_check_callbacks();
 }
 
 /*
kernel/rcutiny_plugin.h +0 -8
index cf0bc22..404b3a3 100644
@@ -104,14 +104,6 @@ static void check_cpu_stalls(void)
 
 /*
  * Because preemptible RCU does not exist, it never has any callbacks
- * to check.
- */
-static void rcu_preempt_check_callbacks(void)
-{
-}
-
-/*
- * Because preemptible RCU does not exist, it never has any callbacks
  * to remove.
  */
 static void rcu_preempt_remove_callbacks(struct rcu_ctrlblk *rcp)
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 4/12 rcu: Remove rcu_preempt_remove_callbacks()

In reply to Paul E. McKenney

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

With the removal of CONFIG_TINY_PREEMPT_RCU, rcu_preempt_remove_callbacks() is now an empty function. This commit therefore eliminates it by inlining it.

---
 kernel/rcutiny.c        | 1 -
 kernel/rcutiny_plugin.h | 8 --------
 2 files changed, 9 deletions(-)
kernel/rcutiny.c +0 -1
index 9178282..6f5a2a6 100644
@@ -289,7 +289,6 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
 	*rcp->donetail = NULL;
 	if (rcp->curtail == rcp->donetail)
 		rcp->curtail = &rcp->rcucblist;
-	rcu_preempt_remove_callbacks(rcp);
 	rcp->donetail = &rcp->rcucblist;
 	local_irq_restore(flags);
 
kernel/rcutiny_plugin.h +0 -8
index 404b3a3..8b835b9 100644
@@ -104,14 +104,6 @@ static void check_cpu_stalls(void)
 
 /*
  * Because preemptible RCU does not exist, it never has any callbacks
- * to remove.
- */
-static void rcu_preempt_remove_callbacks(struct rcu_ctrlblk *rcp)
-{
-}
-
-/*
- * Because preemptible RCU does not exist, it never has any callbacks
  * to process.
  */
 static void rcu_preempt_process_callbacks(void)
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH 5/12 rcu: Remove rcu_preempt_process_callbacks()

In reply to Paul E. McKenney

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

With the removal of CONFIG_TINY_PREEMPT_RCU, rcu_preempt_process_callbacks() is now an empty function. This commit therefore eliminates it by inlining it.

---
 kernel/rcutiny.c        | 1 -
 kernel/rcutiny_plugin.h | 8 --------
 2 files changed, 9 deletions(-)
kernel/rcutiny.c +0 -1
index 6f5a2a6..7fc2339 100644
@@ -314,7 +314,6 @@ static void rcu_process_callbacks(struct softirq_action *unused)
 {
 	__rcu_process_callbacks(&rcu_sched_ctrlblk);
 	__rcu_process_callbacks(&rcu_bh_ctrlblk);
-	rcu_preempt_process_callbacks();
 }
 
 /*
kernel/rcutiny_plugin.h +0 -8
index 8b835b9..bfe9924 100644
@@ -102,14 +102,6 @@ static void check_cpu_stalls(void)
 	RCU_TRACE(check_cpu_stall_preempt());
 }
 
-/*
- * Because preemptible RCU does not exist, it never has any callbacks
- * to process.
- */
-static void rcu_preempt_process_callbacks(void)
-{
-}
-
 /* Hold off callback invocation until early_initcall() time. */
 static int rcu_scheduler_fully_active __read_mostly;
 
Signature · 1 line
1.8.1.5
#6 lore raw

PATCH 6/12 rcu: Simplify RCU_TINY RCU callback invocation

In reply to Paul E. McKenney

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

TINY_PREEMPT_RCU could use a kthread to handle RCU callback invocation, which required an API to abstract kthread vs. softirq invocation. Now that TINY_PREEMPT_RCU is no longer with us, this commit retires this API in favor of direct use of the relevant softirq primitives.

---
 include/linux/rcupdate.h |  1 +
 include/linux/rcutiny.h  |  4 ----
 include/linux/rcutree.h  |  1 -
 kernel/rcutiny.c         | 14 +++++++++-----
 kernel/rcutiny_plugin.h  | 33 ---------------------------------
 5 files changed, 10 insertions(+), 43 deletions(-)
include/linux/rcupdate.h +1 -0
index 0a8276d..1c53a9f 100644
@@ -216,6 +216,7 @@ static inline int rcu_preempt_depth(void)
 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
 
 /* Internal to kernel */
+extern void rcu_init(void);
 extern void rcu_sched_qs(int cpu);
 extern void rcu_bh_qs(int cpu);
 extern void rcu_check_callbacks(int cpu, int user);
include/linux/rcutiny.h +0 -4
index 4e56a9c..592fad8 100644
@@ -27,10 +27,6 @@
 
 #include <linux/cache.h>
 
-static inline void rcu_init(void)
-{
-}
-
 static inline void rcu_barrier_bh(void)
 {
 	wait_rcu_gp(call_rcu_bh);
include/linux/rcutree.h +0 -1
index 952b793..3f1aa8f 100644
@@ -30,7 +30,6 @@
 #ifndef __LINUX_RCUTREE_H
 #define __LINUX_RCUTREE_H
 
-extern void rcu_init(void);
 extern void rcu_note_context_switch(int cpu);
 extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
 extern void rcu_cpu_stall_reset(void);
kernel/rcutiny.c +9 -5
index 7fc2339..4adc9e2 100644
@@ -44,7 +44,6 @@
 
 /* Forward declarations for rcutiny_plugin.h. */
 struct rcu_ctrlblk;
-static void invoke_rcu_callbacks(void);
 static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp);
 static void rcu_process_callbacks(struct softirq_action *unused);
 static void __call_rcu(struct rcu_head *head,
@@ -227,7 +226,7 @@ void rcu_sched_qs(int cpu)
 	local_irq_save(flags);
 	if (rcu_qsctr_help(&rcu_sched_ctrlblk) +
 	    rcu_qsctr_help(&rcu_bh_ctrlblk))
-		invoke_rcu_callbacks();
+		raise_softirq(RCU_SOFTIRQ);
 	local_irq_restore(flags);
 }
 
@@ -240,7 +239,7 @@ void rcu_bh_qs(int cpu)
 
 	local_irq_save(flags);
 	if (rcu_qsctr_help(&rcu_bh_ctrlblk))
-		invoke_rcu_callbacks();
+		raise_softirq(RCU_SOFTIRQ);
 	local_irq_restore(flags);
 }
 
@@ -277,7 +276,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
 					      ACCESS_ONCE(rcp->rcucblist),
 					      need_resched(),
 					      is_idle_task(current),
-					      rcu_is_callbacks_kthread()));
+					      false));
 		return;
 	}
 
@@ -307,7 +306,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
 	RCU_TRACE(rcu_trace_sub_qlen(rcp, cb_count));
 	RCU_TRACE(trace_rcu_batch_end(rcp->name, cb_count, 0, need_resched(),
 				      is_idle_task(current),
-				      rcu_is_callbacks_kthread()));
+				      false));
 }
 
 static void rcu_process_callbacks(struct softirq_action *unused)
@@ -379,3 +378,8 @@ void call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
 	__call_rcu(head, func, &rcu_bh_ctrlblk);
 }
 EXPORT_SYMBOL_GPL(call_rcu_bh);
+
+void rcu_init(void)
+{
+	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
+}
kernel/rcutiny_plugin.h +0 -33
index bfe9924..36fd83c 100644
@@ -102,39 +102,6 @@ static void check_cpu_stalls(void)
 	RCU_TRACE(check_cpu_stall_preempt());
 }
 
-/* Hold off callback invocation until early_initcall() time. */
-static int rcu_scheduler_fully_active __read_mostly;
-
-/*
- * Start up softirq processing of callbacks.
- */
-void invoke_rcu_callbacks(void)
-{
-	if (rcu_scheduler_fully_active)
-		raise_softirq(RCU_SOFTIRQ);
-}
-
-#ifdef CONFIG_RCU_TRACE
-
-/*
- * There is no callback kthread, so this thread is never it.
- */
-static bool rcu_is_callbacks_kthread(void)
-{
-	return false;
-}
-
-#endif /* #ifdef CONFIG_RCU_TRACE */
-
-static int __init rcu_scheduler_really_started(void)
-{
-	rcu_scheduler_fully_active = 1;
-	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
-	raise_softirq(RCU_SOFTIRQ);  /* Invoke any callbacks from early boot. */
-	return 0;
-}
-early_initcall(rcu_scheduler_really_started);
-
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #include <linux/kernel_stat.h>
 
Signature · 1 line
1.8.1.5
#7 lore raw

PATCH 7/12 rcu: Remove check_cpu_stall_preempt()

In reply to Paul E. McKenney

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

With the removal of CONFIG_TINY_PREEMPT_RCU, check_cpu_stall_preempt() is now an empty function. This commit therefore eliminates it by inlining it.

---
 kernel/rcutiny_plugin.h | 7 -------
 1 file changed, 7 deletions(-)
kernel/rcutiny_plugin.h +0 -7
index 36fd83c..bac3a6e 100644
@@ -82,8 +82,6 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp)
 		rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
 }
 
-static void check_cpu_stall_preempt(void);
-
 #endif /* #ifdef CONFIG_RCU_TRACE */
 
 static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp)
@@ -99,7 +97,6 @@ static void check_cpu_stalls(void)
 {
 	RCU_TRACE(check_cpu_stall(&rcu_bh_ctrlblk));
 	RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk));
-	RCU_TRACE(check_cpu_stall_preempt());
 }
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -182,8 +179,4 @@ MODULE_AUTHOR("Paul E. McKenney");
 MODULE_DESCRIPTION("Read-Copy Update tracing for tiny implementation");
 MODULE_LICENSE("GPL");
 
-static void check_cpu_stall_preempt(void)
-{
-}
-
 #endif /* #ifdef CONFIG_RCU_TRACE */
Signature · 1 line
1.8.1.5
#8 lore raw

PATCH 8/12 rcu: Remove the CONFIG_TINY_RCU ifdefs in rcutiny.h

In reply to Paul E. McKenney

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

Now that CONFIG_TINY_PREEMPT_RCU is no more, this commit removes the CONFIG_TINY_RCU ifdefs from include/linux/rcutiny.h in favor of unconditionally compiling the CONFIG_TINY_RCU legs of those ifdefs.

---
 include/linux/rcutiny.h | 28 ----------------------------
 1 file changed, 28 deletions(-)
include/linux/rcutiny.h +0 -28
index 592fad8..07b5aff 100644
@@ -37,8 +37,6 @@ static inline void rcu_barrier_sched(void)
 	wait_rcu_gp(call_rcu_sched);
 }
 
-#ifdef CONFIG_TINY_RCU
-
 static inline void synchronize_rcu_expedited(void)
 {
 	synchronize_sched();	/* Only one CPU, so pretty fast anyway!!! */
@@ -49,17 +47,6 @@ static inline void rcu_barrier(void)
 	rcu_barrier_sched();  /* Only one CPU, so only one list of callbacks! */
 }
 
-#else /* #ifdef CONFIG_TINY_RCU */
-
-void synchronize_rcu_expedited(void);
-
-static inline void rcu_barrier(void)
-{
-	wait_rcu_gp(call_rcu);
-}
-
-#endif /* #else #ifdef CONFIG_TINY_RCU */
-
 static inline void synchronize_rcu_bh(void)
 {
 	synchronize_sched();
@@ -81,8 +68,6 @@ static inline void kfree_call_rcu(struct rcu_head *head,
 	call_rcu(head, func);
 }
 
-#ifdef CONFIG_TINY_RCU
-
 static inline void rcu_preempt_note_context_switch(void)
 {
 }
@@ -93,19 +78,6 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
 	return 0;
 }
 
-#else /* #ifdef CONFIG_TINY_RCU */
-
-void rcu_preempt_note_context_switch(void);
-int rcu_preempt_needs_cpu(void);
-
-static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
-{
-	*delta_jiffies = ULONG_MAX;
-	return rcu_preempt_needs_cpu();
-}
-
-#endif /* #else #ifdef CONFIG_TINY_RCU */
-
 static inline void rcu_note_context_switch(int cpu)
 {
 	rcu_sched_qs(cpu);
Signature · 1 line
1.8.1.5
maintainer
#9 lore raw

Re: [PATCH tip/core/rcu 08/12] rcu: Remove the CONFIG_TINY_RCU ifdefs in rcutiny.h

Quoted 7 lines · Paul E. McKenney

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

Now that CONFIG_TINY_PREEMPT_RCU is no more, this commit removes the CONFIG_TINY_RCU ifdefs from include/linux/rcutiny.h in favor of unconditionally compiling the CONFIG_TINY_RCU legs of those ifdefs.

The #else branches of these ifdefs ought to disappear in the first patch of the series, since they cover the CONFIG_TINY_PREEMPT_RCU case.

- Josh Triplett

#10 lore raw

PATCH 9/12 rcu: Remove rcu_preempt_note_context_switch()

In reply to Paul E. McKenney

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

With the removal of CONFIG_TINY_PREEMPT_RCU, rcu_preempt_note_context_switch() is now an empty function. This commit therefore eliminates it by inlining it.

---
 include/linux/rcutiny.h | 5 -----
 1 file changed, 5 deletions(-)
include/linux/rcutiny.h +0 -5
index 07b5aff..51230b6 100644
@@ -68,10 +68,6 @@ static inline void kfree_call_rcu(struct rcu_head *head,
 	call_rcu(head, func);
 }
 
-static inline void rcu_preempt_note_context_switch(void)
-{
-}
-
 static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
 {
 	*delta_jiffies = ULONG_MAX;
@@ -81,7 +77,6 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
 static inline void rcu_note_context_switch(int cpu)
 {
 	rcu_sched_qs(cpu);
-	rcu_preempt_note_context_switch();
 }
 
 /*
Signature · 1 line
1.8.1.5
#11 lore raw

PATCH 10/12 rcu: Consolidate rcutiny_plugin.h ifdefs

In reply to Paul E. McKenney

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

This commit rearranges code in order to allow ifdefs to be consolidated in kernel/rcutiny_plugin.h, simplifying the code.

---
 kernel/rcutiny_plugin.h | 86 +++++++++++++++++++++++--------------------------
 1 file changed, 40 insertions(+), 46 deletions(-)
kernel/rcutiny_plugin.h +40 -46
index bac3a6e..65ef180 100644
@@ -53,54 +53,10 @@ static struct rcu_ctrlblk rcu_bh_ctrlblk = {
 };
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
+#include <linux/kernel_stat.h>
+
 int rcu_scheduler_active __read_mostly;
 EXPORT_SYMBOL_GPL(rcu_scheduler_active);
-#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
-
-#ifdef CONFIG_RCU_TRACE
-
-static void check_cpu_stall(struct rcu_ctrlblk *rcp)
-{
-	unsigned long j;
-	unsigned long js;
-
-	if (rcu_cpu_stall_suppress)
-		return;
-	rcp->ticks_this_gp++;
-	j = jiffies;
-	js = rcp->jiffies_stall;
-	if (*rcp->curtail && ULONG_CMP_GE(j, js)) {
-		pr_err("INFO: %s stall on CPU (%lu ticks this GP) idle=%llx (t=%lu jiffies q=%ld)\n",
-		       rcp->name, rcp->ticks_this_gp, rcu_dynticks_nesting,
-		       jiffies - rcp->gp_start, rcp->qlen);
-		dump_stack();
-	}
-	if (*rcp->curtail && ULONG_CMP_GE(j, js))
-		rcp->jiffies_stall = jiffies +
-			3 * rcu_jiffies_till_stall_check() + 3;
-	else if (ULONG_CMP_GE(j, js))
-		rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
-}
-
-#endif /* #ifdef CONFIG_RCU_TRACE */
-
-static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp)
-{
-#ifdef CONFIG_RCU_TRACE
-	rcp->ticks_this_gp = 0;
-	rcp->gp_start = jiffies;
-	rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
-#endif /* #ifdef CONFIG_RCU_TRACE */
-}
-
-static void check_cpu_stalls(void)
-{
-	RCU_TRACE(check_cpu_stall(&rcu_bh_ctrlblk));
-	RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk));
-}
-
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-#include <linux/kernel_stat.h>
 
 /*
  * During boot, we forgive RCU lockdep issues.  After this function is
@@ -179,4 +135,42 @@ MODULE_AUTHOR("Paul E. McKenney");
 MODULE_DESCRIPTION("Read-Copy Update tracing for tiny implementation");
 MODULE_LICENSE("GPL");
 
+static void check_cpu_stall(struct rcu_ctrlblk *rcp)
+{
+	unsigned long j;
+	unsigned long js;
+
+	if (rcu_cpu_stall_suppress)
+		return;
+	rcp->ticks_this_gp++;
+	j = jiffies;
+	js = rcp->jiffies_stall;
+	if (*rcp->curtail && ULONG_CMP_GE(j, js)) {
+		pr_err("INFO: %s stall on CPU (%lu ticks this GP) idle=%llx (t=%lu jiffies q=%ld)\n",
+		       rcp->name, rcp->ticks_this_gp, rcu_dynticks_nesting,
+		       jiffies - rcp->gp_start, rcp->qlen);
+		dump_stack();
+	}
+	if (*rcp->curtail && ULONG_CMP_GE(j, js))
+		rcp->jiffies_stall = jiffies +
+			3 * rcu_jiffies_till_stall_check() + 3;
+	else if (ULONG_CMP_GE(j, js))
+		rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
+}
+
 #endif /* #ifdef CONFIG_RCU_TRACE */
+
+static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp)
+{
+#ifdef CONFIG_RCU_TRACE
+	rcp->ticks_this_gp = 0;
+	rcp->gp_start = jiffies;
+	rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
+#endif /* #ifdef CONFIG_RCU_TRACE */
+}
+
+static void check_cpu_stalls(void)
+{
+	RCU_TRACE(check_cpu_stall(&rcu_bh_ctrlblk));
+	RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk));
+}
Signature · 1 line
1.8.1.5
#12 lore raw

PATCH 11/12 rcu: Remove TINY_PREEMPT_RCU tracing documentation

In reply to Paul E. McKenney

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

Because TINY_PREEMPT_RCU is no more, this commit removes its tracing formats from the documentation.

---
 Documentation/RCU/trace.txt | 100 ++------------------------------------------
 1 file changed, 4 insertions(+), 96 deletions(-)
Documentation/RCU/trace.txt +4 -96
index c776968..f3778f8 100644
@@ -530,113 +530,21 @@ o	"nos" counts the number of times we balked for other
 	reasons, e.g., the grace period ended first.
 
 
-CONFIG_TINY_RCU and CONFIG_TINY_PREEMPT_RCU debugfs Files and Formats
+CONFIG_TINY_RCU debugfs Files and Formats
 
 These implementations of RCU provides a single debugfs file under the
 top-level directory RCU, namely rcu/rcudata, which displays fields in
-rcu_bh_ctrlblk, rcu_sched_ctrlblk and, for CONFIG_TINY_PREEMPT_RCU,
-rcu_preempt_ctrlblk.
+rcu_bh_ctrlblk and rcu_sched_ctrlblk.
 
 The output of "cat rcu/rcudata" is as follows:
 
-rcu_preempt: qlen=24 gp=1097669 g197/p197/c197 tasks=...
-             ttb=. btg=no ntb=184 neb=0 nnb=183 j=01f7 bt=0274
-             normal balk: nt=1097669 gt=0 bt=371 b=0 ny=25073378 nos=0
-             exp balk: bt=0 nos=0
 rcu_sched: qlen: 0
 rcu_bh: qlen: 0
 
-This is split into rcu_preempt, rcu_sched, and rcu_bh sections, with the
-rcu_preempt section appearing only in CONFIG_TINY_PREEMPT_RCU builds.
-The last three lines of the rcu_preempt section appear only in
-CONFIG_RCU_BOOST kernel builds.  The fields are as follows:
+This is split into rcu_sched and rcu_bh sections.  The field is as
+follows:
 
 o	"qlen" is the number of RCU callbacks currently waiting either
 	for an RCU grace period or waiting to be invoked.  This is the
 	only field present for rcu_sched and rcu_bh, due to the
 	short-circuiting of grace period in those two cases.
-
-o	"gp" is the number of grace periods that have completed.
-
-o	"g197/p197/c197" displays the grace-period state, with the
-	"g" number being the number of grace periods that have started
-	(mod 256), the "p" number being the number of grace periods
-	that the CPU has responded to (also mod 256), and the "c"
-	number being the number of grace periods that have completed
-	(once again mode 256).
-
-	Why have both "gp" and "g"?  Because the data flowing into
-	"gp" is only present in a CONFIG_RCU_TRACE kernel.
-
-o	"tasks" is a set of bits.  The first bit is "T" if there are
-	currently tasks that have recently blocked within an RCU
-	read-side critical section, the second bit is "N" if any of the
-	aforementioned tasks are blocking the current RCU grace period,
-	and the third bit is "E" if any of the aforementioned tasks are
-	blocking the current expedited grace period.  Each bit is "."
-	if the corresponding condition does not hold.
-
-o	"ttb" is a single bit.  It is "B" if any of the blocked tasks
-	need to be priority boosted and "." otherwise.
-
-o	"btg" indicates whether boosting has been carried out during
-	the current grace period, with "exp" indicating that boosting
-	is in progress for an expedited grace period, "no" indicating
-	that boosting has not yet started for a normal grace period,
-	"begun" indicating that boosting has bebug for a normal grace
-	period, and "done" indicating that boosting has completed for
-	a normal grace period.
-
-o	"ntb" is the total number of tasks subjected to RCU priority boosting
-	periods since boot.
-
-o	"neb" is the number of expedited grace periods that have had
-	to resort to RCU priority boosting since boot.
-
-o	"nnb" is the number of normal grace periods that have had
-	to resort to RCU priority boosting since boot.
-
-o	"j" is the low-order 16 bits of the jiffies counter in hexadecimal.
-
-o	"bt" is the low-order 16 bits of the value that the jiffies counter
-	will have at the next time that boosting is scheduled to begin.
-
-o	In the line beginning with "normal balk", the fields are as follows:
-
-	o	"nt" is the number of times that the system balked from
-		boosting because there were no blocked tasks to boost.
-		Note that the system will balk from boosting even if the
-		grace period is overdue when the currently running task
-		is looping within an RCU read-side critical section.
-		There is no point in boosting in this case, because
-		boosting a running task won't make it run any faster.
-
-	o	"gt" is the number of times that the system balked
-		from boosting because, although there were blocked tasks,
-		none of them were preventing the current grace period
-		from completing.
-
-	o	"bt" is the number of times that the system balked
-		from boosting because boosting was already in progress.
-
-	o	"b" is the number of times that the system balked from
-		boosting because boosting had already completed for
-		the grace period in question.
-
-	o	"ny" is the number of times that the system balked from
-		boosting because it was not yet time to start boosting
-		the grace period in question.
-
-	o	"nos" is the number of times that the system balked from
-		boosting for inexplicable ("not otherwise specified")
-		reasons.  This can actually happen due to races involving
-		increments of the jiffies counter.
-
-o	In the line beginning with "exp balk", the fields are as follows:
-
-	o	"bt" is the number of times that the system balked from
-		boosting because there were no blocked tasks to boost.
-
-	o	"nos" is the number of times that the system balked from
-		 boosting for inexplicable ("not otherwise specified")
-		 reasons.
Signature · 1 line
1.8.1.5
#13 lore raw

PATCH 12/12 rcu: Shrink TINY_RCU by moving exit_rcu()

In reply to Paul E. McKenney

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

Now that TINY_PREEMPT_RCU is no more, exit_rcu() is always an empty function. But if TINY_RCU is going to have an empty function, it should be in include/linux/rcutiny.h, where it does not bloat the kernel. This commit therefore moves exit_rcu() out of kernel/rcupdate.c to kernel/rcutree_plugin.h, and places a static inline empty function in include/linux/rcutiny.h in order to shrink TINY_RCU a bit.

---
 include/linux/rcupdate.h |  2 --
 include/linux/rcutiny.h  |  4 ++++
 include/linux/rcutree.h  |  2 ++
 kernel/rcupdate.c        | 26 +-------------------------
 kernel/rcutree_plugin.h  | 26 ++++++++++++++++++++++++++
 5 files changed, 33 insertions(+), 27 deletions(-)
include/linux/rcupdate.h +0 -2
index 1c53a9f..1d0145a 100644
@@ -240,8 +240,6 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
 					 struct task_struct *next) { }
 #endif /* CONFIG_RCU_USER_QS */
 
-extern void exit_rcu(void);
-
 /**
  * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
  * @a: Code that RCU needs to pay attention to.
include/linux/rcutiny.h +4 -0
index 51230b6..e31005e 100644
@@ -119,6 +119,10 @@ static inline void rcu_cpu_stall_reset(void)
 {
 }
 
+static inline void exit_rcu(void)
+{
+}
+
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 extern int rcu_scheduler_active __read_mostly;
 extern void rcu_scheduler_starting(void);
include/linux/rcutree.h +2 -0
index 3f1aa8f..226169d 100644
@@ -85,6 +85,8 @@ extern void rcu_force_quiescent_state(void);
 extern void rcu_bh_force_quiescent_state(void);
 extern void rcu_sched_force_quiescent_state(void);
 
+extern void exit_rcu(void);
+
 extern void rcu_scheduler_starting(void);
 extern int rcu_scheduler_active __read_mostly;
 
kernel/rcupdate.c +1 -25
index 48ab703..0be1fa2 100644
@@ -104,31 +104,7 @@ void __rcu_read_unlock(void)
 }
 EXPORT_SYMBOL_GPL(__rcu_read_unlock);
 
-/*
- * Check for a task exiting while in a preemptible-RCU read-side
- * critical section, clean up if so.  No need to issue warnings,
- * as debug_check_no_locks_held() already does this if lockdep
- * is enabled.
- */
-void exit_rcu(void)
-{
-	struct task_struct *t = current;
-
-	if (likely(list_empty(&current->rcu_node_entry)))
-		return;
-	t->rcu_read_lock_nesting = 1;
-	barrier();
-	t->rcu_read_unlock_special = RCU_READ_UNLOCK_BLOCKED;
-	__rcu_read_unlock();
-}
-
-#else /* #ifdef CONFIG_PREEMPT_RCU */
-
-void exit_rcu(void)
-{
-}
-
-#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
+#endif /* #ifdef CONFIG_PREEMPT_RCU */
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 static struct lock_class_key rcu_lock_key;
kernel/rcutree_plugin.h +26 -0
index e6cf7e5..086daaf 100644
@@ -931,6 +931,24 @@ static void __init __rcu_init_preempt(void)
 	rcu_init_one(&rcu_preempt_state, &rcu_preempt_data);
 }
 
+/*
+ * Check for a task exiting while in a preemptible-RCU read-side
+ * critical section, clean up if so.  No need to issue warnings,
+ * as debug_check_no_locks_held() already does this if lockdep
+ * is enabled.
+ */
+void exit_rcu(void)
+{
+	struct task_struct *t = current;
+
+	if (likely(list_empty(&current->rcu_node_entry)))
+		return;
+	t->rcu_read_lock_nesting = 1;
+	barrier();
+	t->rcu_read_unlock_special = RCU_READ_UNLOCK_BLOCKED;
+	__rcu_read_unlock();
+}
+
 #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
 
 static struct rcu_state *rcu_state = &rcu_sched_state;
@@ -1099,6 +1117,14 @@ static void __init __rcu_init_preempt(void)
 {
 }
 
+/*
+ * Because preemptible RCU does not exist, tasks cannot possibly exit
+ * while in preemptible RCU read-side critical sections.
+ */
+void exit_rcu(void)
+{
+}
+
 #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
 
 #ifdef CONFIG_RCU_BOOST
Signature · 1 line
1.8.1.5
maintainer Reviewed-by Reviewed-by on the v1 series
#14 lore raw
In reply to Paul E. McKenney
Quoted 21 lines · Paul E. McKenney

This series removes TINY_PREEMPT_RCU, as promised/threatened at
http://lwn.net/Articles/541037/ and https://lkml.org/lkml/2012/11/12/545.

1. Remove TINY_PREEMPT_RCU. This is a straight syntactic removal,
with no attempt at cleanup. The remaining patches do the cleanup.

2. Inline the now-empty show_tiny_preempt_stats() function.

3. Inline the now-empty rcu_preempt_check_callbacks() function.

4. Inline the now-empty rcu_preempt_remove_callbacks() function.

5. Inline the now-empty rcu_preempt_process_callbacks() function.

6. Because TINY_RCU no longer has kthreads, remove the code that
used to abstract away kthread vs. softirq invocation.

7. Inline the now-empty check_cpu_stall_preempt() function.

8. Remove CONFIG_TINY_RCU ifdefs from include/linux/rcutiny.h

Quoted 8 lines

9. Inline the now-empty rcu_preempt_note_context_switch() function.

10. Move code to allow consolidating ifdefs in kernel/rcutiny_plugin.h.

11. Remove TINY_PREEMPT_RCU's tracing formats from documentation.

12. Shrink TINY_RCU a bit by moving exit_rcu() to TREE_RCU, leaving
TINY_RCU with a static inline empty function.

For 2-7 and 9-12:

I responded to patch 8 with a note about moving part of it to patch 1; with that changed,

for those two as well.

#15 lore raw
Quoted 31 lines · Josh Triplett
Quoted 21 lines · Paul E. McKenney

This series removes TINY_PREEMPT_RCU, as promised/threatened at
http://lwn.net/Articles/541037/ and https://lkml.org/lkml/2012/11/12/545.

1. Remove TINY_PREEMPT_RCU. This is a straight syntactic removal,
with no attempt at cleanup. The remaining patches do the cleanup.

2. Inline the now-empty show_tiny_preempt_stats() function.

3. Inline the now-empty rcu_preempt_check_callbacks() function.

4. Inline the now-empty rcu_preempt_remove_callbacks() function.

5. Inline the now-empty rcu_preempt_process_callbacks() function.

6. Because TINY_RCU no longer has kthreads, remove the code that
used to abstract away kthread vs. softirq invocation.

7. Inline the now-empty check_cpu_stall_preempt() function.

8. Remove CONFIG_TINY_RCU ifdefs from include/linux/rcutiny.h

Quoted 8 lines

9. Inline the now-empty rcu_preempt_note_context_switch() function.

10. Move code to allow consolidating ifdefs in kernel/rcutiny_plugin.h.

11. Remove TINY_PREEMPT_RCU's tracing formats from documentation.

12. Shrink TINY_RCU a bit by moving exit_rcu() to TREE_RCU, leaving
TINY_RCU with a static inline empty function.

Quoted 7 lines

For 2-7 and 9-12:

I responded to patch 8 with a note about moving part of it to patch 1; with that changed,

for those two as well.

Thank you for the review, and good point on merging patch 8 into patch 1, will do!

Thanx, Paul