v2 TINY_RCU changes for 3.11
Subsystems (2)
cover v2 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.
13. Shrink TINY_RCU a bit more by making reset_cpu_stall_ticks() and
check_cpu_stalls() inlineable.
Changes from v1: Add Reviewed-bys and add the 13th patch.
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 | 45 - b/include/linux/rcutree.h | 3 b/init/Kconfig | 10 b/kernel/rcupdate.c | 26 - b/kernel/rcutiny.c | 21 b/kernel/rcutiny_plugin.h | 1023 +----------------------------------------- b/kernel/rcutree_plugin.h | 26 + 10 files changed, 96 insertions(+), 1165 deletions(-)
PATCH 1/13 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 +- include/linux/rcutiny.h | 24 +- init/Kconfig | 10 +- kernel/rcutiny_plugin.h | 854 ----------------------------------------------- 5 files changed, 5 insertions(+), 887 deletions(-)
include/linux/hardirq.h +1 -1
@@ -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
@@ -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"
include/linux/rcutiny.h +2 -22
@@ -53,16 +53,7 @@ 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 */ +#endif /* #ifdef CONFIG_TINY_RCU */ static inline void synchronize_rcu_bh (void ) {
@@ -97,18 +88,7 @@ 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 */ +#endif /* #ifdef CONFIG_TINY_RCU */ static inline void rcu_note_context_switch (int cpu) {
init/Kconfig +1 -9
@@ -458,18 +458,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
PATCH 2/13 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
@@ -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
PATCH 3/13 rcu: Remove rcu_preempt_check_callbacks()
In reply to Paul E. McKenneyFrom: "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
@@ -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
@@ -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
PATCH 4/13 rcu: Remove rcu_preempt_remove_callbacks()
In reply to Paul E. McKenneyFrom: "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
@@ -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
@@ -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
PATCH 5/13 rcu: Remove rcu_preempt_process_callbacks()
In reply to Paul E. McKenneyFrom: "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
@@ -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
@@ -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
PATCH 6/13 rcu: Simplify RCU_TINY RCU callback invocation
In reply to Paul E. McKenneyFrom: "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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 7/13 rcu: Remove check_cpu_stall_preempt()
In reply to Paul E. McKenneyFrom: "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
@@ -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
PATCH 8/13 rcu: Remove the CONFIG_TINY_RCU ifdefs in rcutiny.h
In reply to Paul E. McKenneyFrom: "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.
[ paulmck: Moved removal of #else to "Remove TINY_PREEMPT_RCU" as
suggested by Josh Triplett. ]
--- include/linux/rcutiny.h | 8 -------- 1 file changed, 8 deletions(-)
include/linux/rcutiny.h +0 -8
@@ -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,8 +47,6 @@ static inline void rcu_barrier(void)rcu_barrier_sched ();/* Only one CPU, so only one list of callbacks! */ } -#endif /* #ifdef CONFIG_TINY_RCU */ -static inline void synchronize_rcu_bh (void ) {synchronize_sched ();
@@ -72,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 ) { }
@@ -84,8 +78,6 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)return 0 ; } -#endif /* #ifdef CONFIG_TINY_RCU */ -static inline void rcu_note_context_switch (int cpu) {rcu_sched_qs (cpu);
Signature · 1 line
1.8.1.5
PATCH 9/13 rcu: Remove rcu_preempt_note_context_switch()
In reply to Paul E. McKenneyFrom: "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
@@ -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
PATCH 10/13 rcu: Consolidate rcutiny_plugin.h ifdefs
In reply to Paul E. McKenneyFrom: "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
@@ -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
PATCH 11/13 rcu: Remove TINY_PREEMPT_RCU tracing documentation
In reply to Paul E. McKenneyFrom: "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
@@ -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
PATCH 12/13 rcu: Shrink TINY_RCU by moving exit_rcu()
In reply to Paul E. McKenneyFrom: "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
@@ -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
@@ -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
@@ -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
@@ -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 (¤t->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
@@ -932,6 +932,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 (¤t->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;
@@ -1100,6 +1118,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
PATCH 13/13 rcu: Shrink TINY_RCU by reworking CPU-stall ifdefs
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
TINY_RCU's reset_cpu_stall_ticks() and check_cpu_stalls() functions are defined unconditionally, and are empty functions if CONFIG_RCU_TRACE is disabled (which in turns disables detection of RCU CPU stalls). These empty functions can add a bit of bloat to TINY_RCU, so this commit reworks the ifdefs so that these functions are defined only if they actually do something.
--- kernel/rcutiny.c | 4 ++-- kernel/rcutiny_plugin.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-)
kernel/rcutiny.c +2 -2
@@ -204,7 +204,7 @@ static int rcu_is_cpu_rrupt_from_idle(void)*/ static int rcu_qsctr_help (struct rcu_ctrlblk *rcp) { -reset_cpu_stall_ticks (rcp); +RCU_TRACE (reset_cpu_stall_ticks (rcp));if (rcp->rcucblist !=NULL && rcp->donetail != rcp->curtail) { rcp->donetail = rcp->curtail;
@@ -251,7 +251,7 @@ void rcu_bh_qs(int cpu)*/ void rcu_check_callbacks (int cpu,int user) { -check_cpu_stalls (); +RCU_TRACE (check_cpu_stalls ());if (user ||rcu_is_cpu_rrupt_from_idle ())rcu_sched_qs (cpu);else if (!in_softirq ())
kernel/rcutiny_plugin.h +2 -4
@@ -158,15 +158,11 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp) 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 )
@@ -174,3 +170,5 @@ static void check_cpu_stalls(void)RCU_TRACE (check_cpu_stall (&rcu_bh_ctrlblk)); RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk)); } + +#endif /* #ifdef CONFIG_RCU_TRACE */
Signature · 1 line
1.8.1.5
Josh Triplett
maintainerRe: [PATCH tip/core/rcu 13/13] rcu: Shrink TINY_RCU by reworking CPU-stall ifdefs
Quoted 10 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
TINY_RCU's
reset_cpu_stall_ticks()andcheck_cpu_stalls()functions are defined unconditionally, and are empty functions ifCONFIG_RCU_TRACEis disabled (which in turns disables detection of RCU CPU stalls). These empty functions can add a bit of bloat toTINY_RCU, so this commit reworks the ifdefs so that these functions are defined only if they actually do something.Signed-off-by Paul E. McKenney <[email protected]>
Strange. Both of these functions are static, and called in only one place, so shouldn't the compiler inline them (and thus throw them away completely when empty)? Why does it not do so?
- Josh Triplett
Quoted 56 lines
--- kernel/rcutiny.c | 4 ++-- kernel/rcutiny_plugin.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-)kernel/rcutiny.c +2
-2@@ -204,7 +204,7 @@ static int rcu_is_cpu_rrupt_from_idle(void)*/ static int rcu_qsctr_help (struct rcu_ctrlblk *rcp) { -reset_cpu_stall_ticks (rcp); +RCU_TRACE (reset_cpu_stall_ticks (rcp));if (rcp->rcucblist !=NULL && rcp->donetail != rcp->curtail) { rcp->donetail = rcp->curtail;@@ -251,7 +251,7 @@ void rcu_bh_qs(int cpu)*/ void rcu_check_callbacks (int cpu,int user) { -check_cpu_stalls (); +RCU_TRACE (check_cpu_stalls ());if (user ||rcu_is_cpu_rrupt_from_idle ())rcu_sched_qs (cpu);else if (!in_softirq ())kernel/rcutiny_plugin.h +2
-4@@ -158,15 +158,11 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp) 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 )@@ -174,3 +170,5 @@ static void check_cpu_stalls(void)RCU_TRACE (check_cpu_stall (&rcu_bh_ctrlblk)); RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk)); } + +#endif /* #ifdef CONFIG_RCU_TRACE */ Signature · 1 line
1.8.1.5
Re: [PATCH tip/core/rcu 13/13] rcu: Shrink TINY_RCU by reworking CPU-stall ifdefs
Quoted 10 lines · Josh Triplett
Quoted 9 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
TINY_RCU's
reset_cpu_stall_ticks()andcheck_cpu_stalls()functions are defined unconditionally, and are empty functions ifCONFIG_RCU_TRACEis disabled (which in turns disables detection of RCU CPU stalls). These empty functions can add a bit of bloat toTINY_RCU, so this commit reworks the ifdefs so that these functions are defined only if they actually do something.
Quoted 5 lines
Quoted 1 line
Signed-off-by Paul E. McKenney <[email protected]>Strange. Both of these functions are static, and called in only one place, so shouldn't the compiler inline them (and thus throw them away completely when empty)? Why does it not do so?
Good point for most architectures. But given Tiny RCU's purpose, it should allow for stupid compilers. And I do need to fix the commit message to call out the other benefit, namely saving a couple of lines of source code.
Thanx, Paul
Quoted 64 lines
- Josh Triplett
Quoted 56 lines
--- kernel/rcutiny.c | 4 ++-- kernel/rcutiny_plugin.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-)kernel/rcutiny.c +2
-2@@ -204,7 +204,7 @@ static int rcu_is_cpu_rrupt_from_idle(void)*/ static int rcu_qsctr_help (struct rcu_ctrlblk *rcp) { -reset_cpu_stall_ticks (rcp); +RCU_TRACE (reset_cpu_stall_ticks (rcp));if (rcp->rcucblist !=NULL && rcp->donetail != rcp->curtail) { rcp->donetail = rcp->curtail;@@ -251,7 +251,7 @@ void rcu_bh_qs(int cpu)*/ void rcu_check_callbacks (int cpu,int user) { -check_cpu_stalls (); +RCU_TRACE (check_cpu_stalls ());if (user ||rcu_is_cpu_rrupt_from_idle ())rcu_sched_qs (cpu);else if (!in_softirq ())kernel/rcutiny_plugin.h +2
-4@@ -158,15 +158,11 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp) 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 )@@ -174,3 +170,5 @@ static void check_cpu_stalls(void)RCU_TRACE (check_cpu_stall (&rcu_bh_ctrlblk)); RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk)); } + +#endif /* #ifdef CONFIG_RCU_TRACE */ Signature · 1 line
1.8.1.5--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Josh Triplett
maintainerRe: [PATCH tip/core/rcu 13/13] rcu: Shrink TINY_RCU by reworking CPU-stall ifdefs
Quoted 13 lines · Paul E. McKenney
Quoted 12 lines · Josh Triplett
Quoted 10 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
TINY_RCU's
reset_cpu_stall_ticks()andcheck_cpu_stalls()functions are defined unconditionally, and are empty functions ifCONFIG_RCU_TRACEis disabled (which in turns disables detection of RCU CPU stalls). These empty functions can add a bit of bloat toTINY_RCU, so this commit reworks the ifdefs so that these functions are defined only if they actually do something.Signed-off-by Paul E. McKenney <[email protected]>
Quoted 8 lines
Quoted 3 lines
Strange. Both of these functions are static, and called in only one place, so shouldn't the compiler inline them (and thus throw them away completely when empty)? Why does it not do so?
Good point for most architectures. But given Tiny RCU's purpose, it should allow for stupid compilers. And I do need to fix the commit message to call out the other benefit, namely saving a couple of lines of source code.
Regarding function inlining, at least, GCC is usually equally stupid on all architectures. I'd be quite surprised if any architecture actually emits code for these functions. You could also try changing them to "static inline", in which case GCC should *definitely* never emit code for them when empty.
- Josh Triplett
Quoted 67 lines
Thanx, Paul
Quoted 64 lines
- Josh Triplett
Quoted 56 lines
--- kernel/rcutiny.c | 4 ++-- kernel/rcutiny_plugin.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-)kernel/rcutiny.c +2
-2@@ -204,7 +204,7 @@ static int rcu_is_cpu_rrupt_from_idle(void)*/ static int rcu_qsctr_help (struct rcu_ctrlblk *rcp) { -reset_cpu_stall_ticks (rcp); +RCU_TRACE (reset_cpu_stall_ticks (rcp));if (rcp->rcucblist !=NULL && rcp->donetail != rcp->curtail) { rcp->donetail = rcp->curtail;@@ -251,7 +251,7 @@ void rcu_bh_qs(int cpu)*/ void rcu_check_callbacks (int cpu,int user) { -check_cpu_stalls (); +RCU_TRACE (check_cpu_stalls ());if (user ||rcu_is_cpu_rrupt_from_idle ())rcu_sched_qs (cpu);else if (!in_softirq ())kernel/rcutiny_plugin.h +2
-4@@ -158,15 +158,11 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp) 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 )@@ -174,3 +170,5 @@ static void check_cpu_stalls(void)RCU_TRACE (check_cpu_stall (&rcu_bh_ctrlblk)); RCU_TRACE(check_cpu_stall(&rcu_sched_ctrlblk)); } + +#endif /* #ifdef CONFIG_RCU_TRACE */ Signature · 1 line
1.8.1.5--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/