rcu: unify boost and kthread priorities
Subsystems (2)
PATCH 1/1 rcu: unify boost and kthread priorities
Paul,
Here's the result of our conversation Friday, regarding the per-CPU and boost priorities:
Rename CONFIG_RCU_BOOST_PRIO to CONFIG_RCU_KTHREAD_PRIO and use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).
Also, create the module_parameter rcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).
--- Documentation/kernel-parameters.txt | 6 ++++++ init/Kconfig | 23 ++++++++++++----------- kernel/rcu/tree_plugin.h | 16 ++++++++-------- 3 files changed, 26 insertions(+), 19 deletions(-)
(quoted diff) +0 -0
b/Documentation/kernel-parameters.txt index 10d51c2f10d7..471f885ab24d 100644 --- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2856,6 +2856,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. quiescent states. Units are jiffies, minimum
value is one, and maximum value is HZ.
+ rcutree.kthread_prio= [KNL,BOOT]
+ Set the SCHED_FIFO priority of the RCU
+ per-CPU kthreads (rcuc/N). This value is also
+ used for the priority of the RCU boost threads
+ (rcub/N). Valid values are 1-99.
+
rcutree.rcu_nocb_leader_stride= [KNL]
Set the number of NOCB kthread groups, which defaults to the square root of the number of
init/Kconfig +0 -0
@@ -662,30 +662,31 @@ config RCU_BOOST Say Y here if you are working with real-time apps or heavy
loads Say N here if you are unsure.
-config RCU_BOOST_PRIO
- int "Real-time priority to boost RCU readers to"
+config RCU_KTHREAD_PRIO
+ int "Real-time priority to use for RCU worker threads"
range 1 99
depends on RCU_BOOST
default 1
help
- This option specifies the real-time priority to which
long-term
- preempted RCU readers are to be boosted. If you are working - with a real-time application that has one or more CPU-bound - threads running at a real-time priority level, you should set - RCU_BOOST_PRIO to a priority higher then the highest-priority - real-time CPU-bound thread. The default RCU_BOOST_PRIO value - of 1 is appropriate in the common case, which is real-time + This option specifies the SCHED_FIFO priority value that will be + assigned to the rcuc/n and rcub/n threads and is also the value + used for RCU_BOOST (if enabled). If you are working with a + real-time application that has one or more CPU-bound threads + running at a real-time priority level, you should set + RCU_KTHREAD_PRIO to a priority higher than the
highest-priority
+ real-time CPU-bound application thread. The defaultRCU_KTHREAD_PRIO
+ value of 1 is appropriate in the common case, which is
real-time applications that do not have any CPU-bound threads.
Some real-time applications might not have a single real-time thread that saturates a given CPU, but instead might have multiple real-time threads that, taken together, fully
utilize
- that CPU. In this case, you should set RCU_BOOST_PRIO to + that CPU. In this case, you should set RCU_KTHREAD_PRIO to
a priority higher than the lowest-priority thread that is conspiring to prevent the CPU from running any non-real-time tasks. For example, if one thread at priority 10 and another thread at priority 5 are between themselves fully consuming
- the CPU time on a given CPU, then RCU_BOOST_PRIO should be
+ the CPU time on a given CPU, then RCU_KTHREAD_PRIO should be
set to priority 6 or higher.
Specify the real-time priority, or take the default if
unsure. diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index a7997e272564..dfb3b793b80a 100644
kernel/rcu/tree_plugin.h +3 -6
@@ -30,13 +30,10 @@#include <linux/smpboot.h> #include "../time/tick-internal.h" -#define RCU_KTHREAD_PRIO 1 -#ifdef CONFIG_RCU_BOOST -#include "../locking/rtmutex_common.h" -#define RCU_BOOST_PRIO CONFIG_RCU_BOOST_PRIO -#else -#define RCU_BOOST_PRIO RCU_KTHREAD_PRIO +/* rcuc/rcub kthread realtime priority */ +static int kthread_prio =CONFIG_RCU_KTHREAD_PRIO ; +module_param (kthread_prio, int,0644 );#endif #ifdef CONFIG_RCU_NOCB_CPU
@@ -112,6 +109,9 @@ static void __init rcu_bootup_announce_oddness(void) pr_info("\tPoll for callbacks from no-CBs
CPUs.\n"); }
#endif /* #ifdef CONFIG_RCU_NOCB_CPU */
+#ifdef CONFIG_RCU_BOOST
+ pr_info("\tRCU kthread priority: %d.\n", kthread_prio);
+#endif
}
#ifdef CONFIG_TREE_PREEMPT_RCU
@@ -1352,7 +1352,7 @@ static int rcu_spawn_one_boost_kthread(struct rcu_state *rsp, smp_mb__after_unlock_lock();
rnp->boost_kthread_task = t; raw_spin_unlock_irqrestore(&rnp->lock, flags);
- sp.sched_priority = RCU_BOOST_PRIO;
+ sp.sched_priority = kthread_prio;
sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); wake_up_process(t); /* get to TASK_INTERRUPTIBLE quickly. */ return 0;
@@ -1369,7 +1369,7 @@ static void rcu_cpu_kthread_setup(unsigned int cpu) {
struct sched_param sp;
- sp.sched_priority = RCU_KTHREAD_PRIO;
+ sp.sched_priority = kthread_prio;
sched_setscheduler_nocheck(current, SCHED_FIFO, &sp);
}
Signature · 1 line
1.9.3
Quoted 9 lines · Clark Williams
Paul,
Here's the result of our conversation Friday, regarding the per-CPU and boost priorities:
Rename
CONFIG_RCU_BOOST_PRIOtoCONFIG_RCU_KTHREAD_PRIOand use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).
Quoted 5 lines
Also, create the
module_parameterrcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).Signed-off-by Clark Williams <[email protected]>
Thank you, Clark!
I queued this, porting to rcu/dev, which resulted in the following patch. Please check this to make sure it still reflects your intent. In the meantime, I will start testing.
Thanx, Paul
------------------------------------------------------------------------
rcu: unify boost and kthread priorities
Rename CONFIG_RCU_BOOST_PRIO to CONFIG_RCU_KTHREAD_PRIO and use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).
Also, create the module_parameter rcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).
Documentation/kernel-parameters.txt +6 -0
@@ -2899,6 +2899,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. quiescent states. Units are jiffies, minimum value is one, and maximum value is HZ. + rcutree.kthread_prio= [KNL,BOOT] + Set the SCHED_FIFO priority of the RCU + per-CPU kthreads (rcuc/N). This value is also + used for the priority of the RCU boost threads + (rcub/N). Valid values are 1-99. + rcutree.rcu_nocb_leader_stride= [KNL] Set the number of NOCB kthread groups, which defaults to the square root of the number of
init/Kconfig +12 -11
@@ -672,30 +672,31 @@ config RCU_BOOST Say Y here if you are working with real-time apps or heavy loads Say N here if you are unsure. -config RCU_BOOST_PRIO - int "Real-time priority to boost RCU readers to" +config RCU_KTHREAD_PRIO + int "Real-time priority to use for RCU worker threads" range 1 99 depends on RCU_BOOST default 1 help - This option specifies the real-time priority to which long-term - preempted RCU readers are to be boosted. If you are working - with a real-time application that has one or more CPU-bound - threads running at a real-time priority level, you should set - RCU_BOOST_PRIO to a priority higher then the highest-priority - real-time CPU-bound thread. The default RCU_BOOST_PRIO value - of 1 is appropriate in the common case, which is real-time + This option specifies the SCHED_FIFO priority value that will be + assigned to the rcuc/n and rcub/n threads and is also the value + used for RCU_BOOST (if enabled). If you are working with a + real-time application that has one or more CPU-bound threads + running at a real-time priority level, you should set + RCU_KTHREAD_PRIO to a priority higher than the highest-priority + real-time CPU-bound application thread. The default RCU_KTHREAD_PRIO + value of 1 is appropriate in the common case, which is real-time applications that do not have any CPU-bound threads. Some real-time applications might not have a single real-time thread that saturates a given CPU, but instead might have multiple real-time threads that, taken together, fully utilize - that CPU. In this case, you should set RCU_BOOST_PRIO to + that CPU. In this case, you should set RCU_KTHREAD_PRIO to a priority higher than the lowest-priority thread that is conspiring to prevent the CPU from running any non-real-time tasks. For example, if one thread at priority 10 and another thread at priority 5 are between themselves fully consuming - the CPU time on a given CPU, then RCU_BOOST_PRIO should be + the CPU time on a given CPU, then RCU_KTHREAD_PRIO should be set to priority 6 or higher. Specify the real-time priority, or take the default if unsure.
kernel/rcu/tree_plugin.h +10 -10
@@ -30,12 +30,13 @@#include <linux/smpboot.h> #include "../time/tick-internal.h" -#define RCU_KTHREAD_PRIO 1 -#ifdef CONFIG_RCU_BOOST #include "../locking/rtmutex_common.h" -#define RCU_BOOST_PRIO CONFIG_RCU_BOOST_PRIO + +/* rcuc/rcub kthread realtime priority */ +static int kthread_prio =CONFIG_RCU_KTHREAD_PRIO ; +module_param (kthread_prio, int,0644 );/* * Control variables for per-CPU and per-rcu_node kthreads. These
@@ -46,11 +47,7 @@ DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_status); DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops);DEFINE_PER_CPU (char, rcu_cpu_has_work); -#else /* #ifdef CONFIG_RCU_BOOST */ - -#define RCU_BOOST_PRIO RCU_KTHREAD_PRIO - -#endif /* #else #ifdef CONFIG_RCU_BOOST */ +#endif /* #ifdef CONFIG_RCU_BOOST */ #ifdef CONFIG_RCU_NOCB_CPU static cpumask_var_t rcu_nocb_mask;/* CPUs to have callbacks offloaded. */
@@ -95,6 +92,9 @@ static void __init rcu_bootup_announce_oddness(void)pr_info ("\tBoot-time adjustment of leaf fanout to %d.\n" , rcu_fanout_leaf);if (nr_cpu_ids !=NR_CPUS )pr_info ("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n" ,NR_CPUS , nr_cpu_ids); +#ifdef CONFIG_RCU_BOOST +pr_info ("\tRCU kthread priority: %d.\n" , kthread_prio); +#endif }#ifdef CONFIG_TREE_PREEMPT_RCU
@@ -1326,7 +1326,7 @@ static int rcu_spawn_one_boost_kthread(struct rcu_state *rsp,smp_mb__after_unlock_lock (); rnp->boost_kthread_task = t;raw_spin_unlock_irqrestore (&rnp->lock, flags); - sp.sched_priority =RCU_BOOST_PRIO ; + sp.sched_priority = kthread_prio;sched_setscheduler_nocheck (t,SCHED_FIFO , &sp);wake_up_process (t);/* get to TASK_INTERRUPTIBLE quickly. */ return 0 ;
@@ -1343,7 +1343,7 @@ static void rcu_cpu_kthread_setup(unsigned int cpu) {struct sched_param sp; - sp.sched_priority =RCU_KTHREAD_PRIO ; + sp.sched_priority = kthread_prio;sched_setscheduler_nocheck (current,SCHED_FIFO , &sp); }
Quoted 16 lines · On Tue, 16 Sep 2014 13:41:56 -0700 "Paul E. McKenney"…
Quoted 9 lines · Clark Williams
Paul,
Here's the result of our conversation Friday, regarding the per-CPU and boost priorities:
Rename
CONFIG_RCU_BOOST_PRIOtoCONFIG_RCU_KTHREAD_PRIOand use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).Quoted 5 lines
Also, create the
module_parameterrcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).Signed-off-by Clark Williams <[email protected]>
Quoted 7 lines
Thank you, Clark!
I queued this, porting to rcu/dev, which resulted in the following patch. Please check this to make sure it still reflects your intent. In the meantime, I will start testing.
Thanx, Paul
Yes, looks right (and you fixed that I didn't have it all under RCU_BOOST).
Thanks,
Clark
Quoted 21 lines · Clark Williams
Quoted 18 lines · On Tue, 16 Sep 2014 13:41:56 -0700 "Paul E. McKenney"…
Quoted 9 lines · Clark Williams
Paul,
Here's the result of our conversation Friday, regarding the per-CPU and boost priorities:
Rename
CONFIG_RCU_BOOST_PRIOtoCONFIG_RCU_KTHREAD_PRIOand use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).Quoted 5 lines
Also, create the
module_parameterrcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).Signed-off-by Clark Williams <[email protected]>Thank you, Clark!
Quoted 8 lines
Quoted 5 lines
I queued this, porting to rcu/dev, which resulted in the following patch. Please check this to make sure it still reflects your intent. In the meantime, I will start testing.
Thanx, Paul
Yes, looks right (and you fixed that I didn't have it all under
RCU_BOOST).
Very good! Early testing looks good, will let you know how it goes.
Thanx, Paul
Hi Paul,
Quoted 6 lines · Paul E. McKenney
rcu: unify boost and kthread priorities
Rename
CONFIG_RCU_BOOST_PRIOtoCONFIG_RCU_KTHREAD_PRIOand use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).
Quoted 6 lines
Also, create the
module_parameterrcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).Signed-off-by Clark Williams <[email protected]>[ paulmck: Ported to rcu/dev. ]Signed-off-by Paul E. McKenney <[email protected]>
This landed in today's linux-next (ie, next-20140917) as commit 04a96e05bda6 ("rcu: unify boost and kthread priorities").
kernel/rcu/tree_plugin.h
Quoted 6 lines
Documentation/kernel-parameters.txt +0
-0init/Kconfig +0
-0kernel/rcu/tree_plugin.h +0
-0
There's a reference to CONFIG_RCU_BOOST_PRIO in tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt. It needs updating too, doesn't it?
Paul Bolle
Quoted 19 lines · Paul Bolle
Hi Paul,
Quoted 6 lines · Paul E. McKenney
rcu: unify boost and kthread priorities
Rename
CONFIG_RCU_BOOST_PRIOtoCONFIG_RCU_KTHREAD_PRIOand use this value for both the per-CPU kthreads (rcuc/N) and the rcu boosting threads (rcub/n).Quoted 6 lines
Also, create the
module_parameterrcutree.kthread_prio to be used on the kernel command line at boot to set a new value (rcutree.kthread_prio=N).Signed-off-by Clark Williams <[email protected]>[ paulmck: Ported to rcu/dev. ]Signed-off-by Paul E. McKenney <[email protected]>This landed in today's linux-next (ie, next-20140917) as commit
04a96e05bda6("rcu: unify boost and kthread priorities").
Quoted 10 lines
kernel/rcu/tree_plugin.h
Quoted 6 lines
Documentation/kernel-parameters.txt +0
-0init/Kconfig +0
-0kernel/rcu/tree_plugin.h +0
-0There's a reference to
CONFIG_RCU_BOOST_PRIOintools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt. It needs updating too, doesn't it?
Good catch!
Also the one in tools/testing/selftests/rcutorture/configs/rcu/TREE03.
Fixed both, thank you!
Thanx, Paul
Quoted 10 lines · Paul E. McKenney
Quoted 3 lines · Paul Bolle
There's a reference to
CONFIG_RCU_BOOST_PRIOintools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt. It needs updating too, doesn't it?Good catch!
Also the one in
tools/testing/selftests/rcutorture/configs/rcu/TREE03.From my local perl monstrosity:
# ... and Paul McKenney's rcutorture stuff (v3.14-rc+)
if ($blob->[1] =~ /tools\/testing\/selftests\/rcutorture\/configs\/.*/) {Ie, I've made that script ignore all references to Kconfig macros below tools/testing/selftest/rcutorture/configs. Is that too crude?
Quoted 1 line
Fixed both, thank you!
Paul Bolle
Quoted 8 lines · Paul Bolle
Quoted 7 lines · Paul E. McKenney
Quoted 3 lines · Paul Bolle
There's a reference to
CONFIG_RCU_BOOST_PRIOintools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt. It needs updating too, doesn't it?Good catch!
Quoted 8 lines
Quoted 3 lines
Also the one in
tools/testing/selftests/rcutorture/configs/rcu/TREE03.From my local perl monstrosity:
# ... and Paul McKenney's rcutorture stuff (v3.14-rc+) if ($blob->[1] =~ /tools\/testing\/selftests\/rcutorture\/configs\/.*/) {Ie, I've made that script ignore all references to
Kconfigmacros belowtools/testing/selftest/rcutorture/configs. Is that too crude?
It would not hurt to check the files that appear in the CFLIST files:
tools/testing/selftests/rcutorture/configs/lock/CFLIST tools/testing/selftests/rcutorture/configs/rcu/CFLIST
These files drive the torture-test kernel configurations.
That said, yes, there are sometimes some obsolete or deprecated Kconfig parameters in these files because some systems need them.
Thanx, Paul
Quoted 5 lines
Quoted 1 line
Fixed both, thank you!
Paul Bolle