Re: [PATCH v2] rcu: Allow to eliminate softirq processing from rcutree

From: Paul E. McKenney
Date: Wed Mar 20 2019 - 13:29:20 EST


On Wed, Mar 20, 2019 at 05:35:32PM +0100, Sebastian Andrzej Siewior wrote:
> On 2019-03-20 09:15:00 [-0700], Paul E. McKenney wrote:
> > I am considering making it a module_param() to avoid namespace pollution,
> > as it would become something like rcutree.nosoftirq.
> >
> > Thoughts?
>
> nope, perfect.

Please see below for an untested patch. Thoughts?

Thanx, Paul

------------------------------------------------------------------------

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index d377a2166b79..767cdea30a1c 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3672,6 +3672,10 @@
the propagation of recent CPU-hotplug changes up
the rcu_node combining tree.

+ rcutree.nosoftirq= [KNL]
+ If set, move all RCU_SOFTIRQ processing to per-CPU
+ rcuc kthreads. Defaults to using RCU_SOFTIRQ.
+
rcutree.rcu_fanout_exact= [KNL]
Disable autobalancing of the rcu_node combining
tree. This is used by rcutorture, and might
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 961dbc7b8949..e4baba8800f3 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -98,6 +98,9 @@ struct rcu_state rcu_state = {
/* Dump rcu_node combining tree at boot to verify correct setup. */
static bool dump_tree;
module_param(dump_tree, bool, 0444);
+/* Move RCU_SOFTIRQ to rcuc kthreads. */
+static bool nosoftirq;
+module_param(nosoftirq, bool, 0444);
/* Control rcu_node-tree auto-balancing at boot time. */
static bool rcu_fanout_exact;
module_param(rcu_fanout_exact, bool, 0444);
@@ -2330,15 +2333,6 @@ static void rcu_wake_cond(struct task_struct *t, int status)
wake_up_process(t);
}

-static bool rcu_softirq_enabled = true;
-
-static int __init rcunosoftirq_setup(char *str)
-{
- rcu_softirq_enabled = false;
- return 0;
-}
-__setup("rcunosoftirq", rcunosoftirq_setup);
-
/*
* Wake up this CPU's rcuc kthread to do RCU core processing.
*/
@@ -2349,7 +2343,7 @@ static void invoke_rcu_core(void)

if (!cpu_online(smp_processor_id()))
return;
- if (rcu_softirq_enabled) {
+ if (!nosoftirq) {
raise_softirq(RCU_SOFTIRQ);
} else {
local_irq_save(flags);
@@ -2424,7 +2418,7 @@ static int __init rcu_spawn_core_kthreads(void)

for_each_possible_cpu(cpu)
per_cpu(rcu_data.rcu_cpu_has_work, cpu) = 0;
- if (!IS_ENABLED(CONFIG_RCU_BOOST) && rcu_softirq_enabled)
+ if (!IS_ENABLED(CONFIG_RCU_BOOST) && !nosoftirq)
return 0;
WARN_ONCE(smpboot_register_percpu_thread(&rcu_cpu_thread_spec), "%s: Could not start rcub kthread, OOM is now expected behavior\n", __func__);
return 0;
@@ -3467,7 +3461,7 @@ void __init rcu_init(void)
rcu_init_one();
if (dump_tree)
rcu_dump_rcu_node_tree();
- if (rcu_softirq_enabled)
+ if (!nosoftirq)
open_softirq(RCU_SOFTIRQ, rcu_core_si);

/*
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index eb99e750a930..c5a2acb2c7af 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -72,6 +72,8 @@ static void __init rcu_bootup_announce_oddness(void)
pr_info("\tRCU debug GP init slowdown %d jiffies.\n", gp_init_delay);
if (gp_cleanup_delay)
pr_info("\tRCU debug GP init slowdown %d jiffies.\n", gp_cleanup_delay);
+ if (nosoftirq)
+ pr_info("\tRCU_SOFTIRQ processing moved to rcuc kthreads.\n");
if (IS_ENABLED(CONFIG_RCU_EQS_DEBUG))
pr_info("\tRCU debug extended QS entry/exit.\n");
rcupdate_announce_bootup_oddness();