RCU tasks updates for v5.9
Paul E. McKenney
maintainercover RCU tasks updates for v5.9
Hello!
This series contains code-style and build-issue fixes to the various RCU Tasks flavors.
1. rcu-tasks: Convert sleeps to idle priority.
2. rcu-tasks: Make rcu_tasks_postscan() be static.
3. rcu-tasks: Add #include of rcupdate_trace.h to update.c.
4. rcu-tasks: Conditionally compile show_rcu_tasks_gp_kthreads().
5. rcu-tasks: Fix code-style issues.
Thanx, Paul
------------------------------------------------------------------------
tasks.h | 28 +++++++++++++++++++++------- update.c | 1 + 2 files changed, 22 insertions(+), 7 deletions(-)
[email protected]
maintainerPATCH 1/5 rcu-tasks: Convert sleeps to idle priority
From: "Paul E. McKenney" <[email protected]>
This commit converts the long-standing schedule_timeout_interruptible() and schedule_timeout_uninterruptible() calls used by the various Tasks RCU's grace-period kthreads to schedule_timeout_idle(). This conversion avoids polluting the load-average with Tasks-RCU-related sleeping.
--- kernel/rcu/tasks.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tasks.h +3 -3
@@ -205,7 +205,7 @@ static int __noreturn rcu_tasks_kthread(void *arg)if (!rtp->cbs_head) {WARN_ON (signal_pending (current));set_tasks_gp_state (rtp,RTGS_WAIT_WAIT_CBS ); -schedule_timeout_interruptible (HZ /10 ); +schedule_timeout_idle (HZ /10 ); }continue ; }
@@ -227,7 +227,7 @@ static int __noreturn rcu_tasks_kthread(void *arg)cond_resched (); }/* Paranoid sleep to keep this from entering a tight loop */ -schedule_timeout_uninterruptible (HZ /10 ); +schedule_timeout_idle (HZ /10 );set_tasks_gp_state (rtp,RTGS_WAIT_CBS ); }
@@ -336,7 +336,7 @@ static void rcu_tasks_wait_gp(struct rcu_tasks *rtp)/* Slowly back off waiting for holdouts */ set_tasks_gp_state (rtp,RTGS_WAIT_SCAN_HOLDOUTS ); -schedule_timeout_interruptible (HZ /fract); +schedule_timeout_idle (HZ /fract);if (fract >1 ) fract--;
Signature · 1 line
2.9.5
[email protected]
maintainerPATCH 2/5 rcu-tasks: Make rcu_tasks_postscan() be static
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
The rcu_tasks_postscan() function is not used outside of RCU's tasks.h file, so this commit makes it be static.
--- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tasks.h +1 -1
@@ -402,7 +402,7 @@ static void rcu_tasks_pertask(struct task_struct *t, struct list_head *hop) }/* Processing between scanning taskslist and draining the holdout list. */ -void rcu_tasks_postscan (struct list_head *hop) +static void rcu_tasks_postscan (struct list_head *hop) {/* * Wait for tasks that are in the process of exiting. This
Signature · 1 line
2.9.5
[email protected]
maintainerPATCH 3/5 rcu-tasks: Add #include of rcupdate_trace.h to update.c
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
Although this is in some strict sense unnecessary, it is good to allow the compiler to compare the function declaration with its definition. This commit therefore adds a #include of linux/rcupdate_trace.h to kernel/rcu/update.c.
--- kernel/rcu/update.c | 1 + 1 file changed, 1 insertion(+)
kernel/rcu/update.c +1 -0
@@ -42,6 +42,7 @@#include <linux/kprobes.h> #include <linux/slab.h> #include <linux/irq_work.h> +#include <linux/rcupdate_trace.h> #define CREATE_TRACE_POINTS
Signature · 1 line
2.9.5
[email protected]
maintainerPATCH 4/5 rcu-tasks: Conditionally compile show_rcu_tasks_gp_kthreads()
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
The show_rcu_tasks_gp_kthreads() function is not invoked by Tiny RCU, but is nevertheless defined in Tiny RCU builds that enable Tasks Trace RCU. This commit therefore conditionally compiles this function so that it is defined only in builds that actually use it.
--- kernel/rcu/tasks.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
kernel/rcu/tasks.h +14 -0
@@ -103,6 +103,7 @@ module_param(rcu_task_stall_timeout, int, 0644);#define RTGS_WAIT_READERS 9#define RTGS_INVOKE_CBS 10#define RTGS_WAIT_CBS 11 +#ifndef CONFIG_TINY_RCU static const char *const rcu_tasks_gp_state_names[] = {"RTGS_INIT" , "RTGS_WAIT_WAIT_CBS",
@@ -117,6 +118,7 @@ static const char * const rcu_tasks_gp_state_names[] = {"RTGS_INVOKE_CBS" , "RTGS_WAIT_CBS", }; +#endif /* #ifndef CONFIG_TINY_RCU */ //////////////////////////////////////////////////////////////////////// //
@@ -129,6 +131,7 @@ static void set_tasks_gp_state(struct rcu_tasks *rtp, int newstate) rtp->gp_jiffies = jiffies; } +#ifndef CONFIG_TINY_RCU /* Return state name. */ static const char *tasks_gp_state_getname (struct rcu_tasks *rtp) {
@@ -139,6 +142,7 @@ static const char *tasks_gp_state_getname(struct rcu_tasks *rtp)return "???" ;return rcu_tasks_gp_state_names[j]; } +#endif /* #ifndef CONFIG_TINY_RCU */ // Enqueue a callback for the specified flavor of Tasks RCU. static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,
@@ -268,6 +272,7 @@ static void __init rcu_tasks_bootup_oddness(void)#endif /* #ifndef CONFIG_TINY_RCU */ +#ifndef CONFIG_TINY_RCU /* Dump out rcutorture-relevant state common to all RCU-tasks flavors. */ static void show_rcu_tasks_generic_gp_kthread (struct rcu_tasks *rtp,char *s) {
@@ -281,6 +286,7 @@ static void show_rcu_tasks_generic_gp_kthread(struct rcu_tasks *rtp, char *s)".C" [!!data_race (rtp->cbs_head)], s); } +#endif /* #ifndef CONFIG_TINY_RCU */ static void exit_tasks_rcu_finish_trace (struct task_struct *t);
@@ -557,10 +563,12 @@ static int __init rcu_spawn_tasks_kthread(void) }core_initcall (rcu_spawn_tasks_kthread); +#ifndef CONFIG_TINY_RCU static void show_rcu_tasks_classic_gp_kthread (void ) {show_rcu_tasks_generic_gp_kthread (&rcu_tasks,"" ); } +#endif /* #ifndef CONFIG_TINY_RCU */ /* Do the srcu_read_lock() for the above synchronize_srcu(). */ void exit_tasks_rcu_start(void) __acquires(&tasks_rcu_exit_srcu)
@@ -682,10 +690,12 @@ static int __init rcu_spawn_tasks_rude_kthread(void) }core_initcall (rcu_spawn_tasks_rude_kthread); +#ifndef CONFIG_TINY_RCU static void show_rcu_tasks_rude_gp_kthread (void ) {show_rcu_tasks_generic_gp_kthread (&rcu_tasks_rude,"" ); } +#endif /* #ifndef CONFIG_TINY_RCU */ #else /* #ifdef CONFIG_TASKS_RUDE_RCU */ static void show_rcu_tasks_rude_gp_kthread (void ) {}
@@ -1164,6 +1174,7 @@ static int __init rcu_spawn_tasks_trace_kthread(void) }core_initcall (rcu_spawn_tasks_trace_kthread); +#ifndef CONFIG_TINY_RCU static void show_rcu_tasks_trace_gp_kthread (void ) {char buf[64 ];
@@ -1174,18 +1185,21 @@ static void show_rcu_tasks_trace_gp_kthread(void) data_race(n_heavy_reader_attempts));show_rcu_tasks_generic_gp_kthread (&rcu_tasks_trace, buf); } +#endif /* #ifndef CONFIG_TINY_RCU */ #else /* #ifdef CONFIG_TASKS_TRACE_RCU */ static void exit_tasks_rcu_finish_trace (struct task_struct *t) { }static inline void show_rcu_tasks_trace_gp_kthread (void ) {}#endif /* #else #ifdef CONFIG_TASKS_TRACE_RCU */ +#ifndef CONFIG_TINY_RCU void show_rcu_tasks_gp_kthreads (void ) {show_rcu_tasks_classic_gp_kthread ();show_rcu_tasks_rude_gp_kthread ();show_rcu_tasks_trace_gp_kthread (); } +#endif /* #ifndef CONFIG_TINY_RCU */ #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ static inline void rcu_tasks_bootup_oddness (void ) {}
Signature · 1 line
2.9.5
[email protected]
maintainerPATCH 5/5 rcu-tasks: Fix code-style issues
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
This commit declares trc_n_readers_need_end and trc_wait static and replaced a "&" with "&&". The "&" happened to work because the values are bool, but accidents waiting to happen and all that...
--- kernel/rcu/tasks.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tasks.h +3 -3
@@ -737,8 +737,8 @@ EXPORT_SYMBOL_GPL(rcu_trace_lock_map);#ifdef CONFIG_TASKS_TRACE_RCU -atomic_t trc_n_readers_need_end;// Number of waited-for readers. -DECLARE_WAIT_QUEUE_HEAD (trc_wait);// List of holdout tasks. +static atomic_t trc_n_readers_need_end;// Number of waited-for readers. +static DECLARE_WAIT_QUEUE_HEAD (trc_wait);// List of holdout tasks. // Record outstanding IPIs to each CPU. No point in sending two... static DEFINE_PER_CPU(bool, trc_ipi_to_cpu);
@@ -845,7 +845,7 @@ static bool trc_inspect_reader(struct task_struct *t, void *arg)bool ofl =cpu_is_offline (cpu);if (task_curr (t)) { -WARN_ON_ONCE (ofl & !is_idle_task (t)); +WARN_ON_ONCE (ofl && !is_idle_task (t));// If no chance of heavyweight readers, do it the hard way. if (!ofl && !IS_ENABLED (CONFIG_TASKS_TRACE_RCU_READ_MB ))
Signature · 1 line
2.9.5