diff options
author | Clark Williams <clark.williams@gmail.com> | 2014-09-12 22:21:09 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-10-29 13:19:41 -0400 |
commit | 21871d7eff2c96ae67e18e00adf59d56940e2fcc (patch) | |
tree | e1d6d5c5b7e1f3b70715451c1a04f591293fb474 | |
parent | e0775cefb5ede661dbdc0611d7bf3fcd4640005c (diff) |
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).
Signed-off-by: Clark Williams <clark.williams@gmail.com>
[ paulmck: Ported to rcu/dev, applied Paul Bolle and Peter Zijlstra feedback. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | Documentation/kernel-parameters.txt | 7 | ||||
-rw-r--r-- | init/Kconfig | 23 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 20 | ||||
-rw-r--r-- | tools/testing/selftests/rcutorture/configs/rcu/TREE03 | 2 | ||||
-rw-r--r-- | tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt | 4 |
5 files changed, 32 insertions, 24 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 7dbe5ec9d9cd..6608520e9fa2 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -2922,6 +2922,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2922 | quiescent states. Units are jiffies, minimum | 2922 | quiescent states. Units are jiffies, minimum |
2923 | value is one, and maximum value is HZ. | 2923 | value is one, and maximum value is HZ. |
2924 | 2924 | ||
2925 | rcutree.kthread_prio= [KNL,BOOT] | ||
2926 | Set the SCHED_FIFO priority of the RCU | ||
2927 | per-CPU kthreads (rcuc/N). This value is also | ||
2928 | used for the priority of the RCU boost threads | ||
2929 | (rcub/N). Valid values are 1-99 and the default | ||
2930 | is 1 (the least-favored priority). | ||
2931 | |||
2925 | rcutree.rcu_nocb_leader_stride= [KNL] | 2932 | rcutree.rcu_nocb_leader_stride= [KNL] |
2926 | Set the number of NOCB kthread groups, which | 2933 | Set the number of NOCB kthread groups, which |
2927 | defaults to the square root of the number of | 2934 | defaults to the square root of the number of |
diff --git a/init/Kconfig b/init/Kconfig index 0c9546ba56e8..15c299cc7c1e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -672,30 +672,31 @@ config RCU_BOOST | |||
672 | Say Y here if you are working with real-time apps or heavy loads | 672 | Say Y here if you are working with real-time apps or heavy loads |
673 | Say N here if you are unsure. | 673 | Say N here if you are unsure. |
674 | 674 | ||
675 | config RCU_BOOST_PRIO | 675 | config RCU_KTHREAD_PRIO |
676 | int "Real-time priority to boost RCU readers to" | 676 | int "Real-time priority to use for RCU worker threads" |
677 | range 1 99 | 677 | range 1 99 |
678 | depends on RCU_BOOST | 678 | depends on RCU_BOOST |
679 | default 1 | 679 | default 1 |
680 | help | 680 | help |
681 | This option specifies the real-time priority to which long-term | 681 | This option specifies the SCHED_FIFO priority value that will be |
682 | preempted RCU readers are to be boosted. If you are working | 682 | assigned to the rcuc/n and rcub/n threads and is also the value |
683 | with a real-time application that has one or more CPU-bound | 683 | used for RCU_BOOST (if enabled). If you are working with a |
684 | threads running at a real-time priority level, you should set | 684 | real-time application that has one or more CPU-bound threads |
685 | RCU_BOOST_PRIO to a priority higher then the highest-priority | 685 | running at a real-time priority level, you should set |
686 | real-time CPU-bound thread. The default RCU_BOOST_PRIO value | 686 | RCU_KTHREAD_PRIO to a priority higher than the highest-priority |
687 | of 1 is appropriate in the common case, which is real-time | 687 | real-time CPU-bound application thread. The default RCU_KTHREAD_PRIO |
688 | value of 1 is appropriate in the common case, which is real-time | ||
688 | applications that do not have any CPU-bound threads. | 689 | applications that do not have any CPU-bound threads. |
689 | 690 | ||
690 | Some real-time applications might not have a single real-time | 691 | Some real-time applications might not have a single real-time |
691 | thread that saturates a given CPU, but instead might have | 692 | thread that saturates a given CPU, but instead might have |
692 | multiple real-time threads that, taken together, fully utilize | 693 | multiple real-time threads that, taken together, fully utilize |
693 | that CPU. In this case, you should set RCU_BOOST_PRIO to | 694 | that CPU. In this case, you should set RCU_KTHREAD_PRIO to |
694 | a priority higher than the lowest-priority thread that is | 695 | a priority higher than the lowest-priority thread that is |
695 | conspiring to prevent the CPU from running any non-real-time | 696 | conspiring to prevent the CPU from running any non-real-time |
696 | tasks. For example, if one thread at priority 10 and another | 697 | tasks. For example, if one thread at priority 10 and another |
697 | thread at priority 5 are between themselves fully consuming | 698 | thread at priority 5 are between themselves fully consuming |
698 | the CPU time on a given CPU, then RCU_BOOST_PRIO should be | 699 | the CPU time on a given CPU, then RCU_KTHREAD_PRIO should be |
699 | set to priority 6 or higher. | 700 | set to priority 6 or higher. |
700 | 701 | ||
701 | Specify the real-time priority, or take the default if unsure. | 702 | 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 357891104ea0..344f0e661515 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -30,12 +30,13 @@ | |||
30 | #include <linux/smpboot.h> | 30 | #include <linux/smpboot.h> |
31 | #include "../time/tick-internal.h" | 31 | #include "../time/tick-internal.h" |
32 | 32 | ||
33 | #define RCU_KTHREAD_PRIO 1 | ||
34 | |||
35 | #ifdef CONFIG_RCU_BOOST | 33 | #ifdef CONFIG_RCU_BOOST |
36 | 34 | ||
37 | #include "../locking/rtmutex_common.h" | 35 | #include "../locking/rtmutex_common.h" |
38 | #define RCU_BOOST_PRIO CONFIG_RCU_BOOST_PRIO | 36 | |
37 | /* rcuc/rcub kthread realtime priority */ | ||
38 | static int kthread_prio = CONFIG_RCU_KTHREAD_PRIO; | ||
39 | module_param(kthread_prio, int, 0644); | ||
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Control variables for per-CPU and per-rcu_node kthreads. These | 42 | * Control variables for per-CPU and per-rcu_node kthreads. These |
@@ -46,11 +47,7 @@ DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_status); | |||
46 | DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops); | 47 | DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops); |
47 | DEFINE_PER_CPU(char, rcu_cpu_has_work); | 48 | DEFINE_PER_CPU(char, rcu_cpu_has_work); |
48 | 49 | ||
49 | #else /* #ifdef CONFIG_RCU_BOOST */ | 50 | #endif /* #ifdef CONFIG_RCU_BOOST */ |
50 | |||
51 | #define RCU_BOOST_PRIO RCU_KTHREAD_PRIO | ||
52 | |||
53 | #endif /* #else #ifdef CONFIG_RCU_BOOST */ | ||
54 | 51 | ||
55 | #ifdef CONFIG_RCU_NOCB_CPU | 52 | #ifdef CONFIG_RCU_NOCB_CPU |
56 | static cpumask_var_t rcu_nocb_mask; /* CPUs to have callbacks offloaded. */ | 53 | static cpumask_var_t rcu_nocb_mask; /* CPUs to have callbacks offloaded. */ |
@@ -98,6 +95,9 @@ static void __init rcu_bootup_announce_oddness(void) | |||
98 | pr_info("\tBoot-time adjustment of leaf fanout to %d.\n", rcu_fanout_leaf); | 95 | pr_info("\tBoot-time adjustment of leaf fanout to %d.\n", rcu_fanout_leaf); |
99 | if (nr_cpu_ids != NR_CPUS) | 96 | if (nr_cpu_ids != NR_CPUS) |
100 | pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids); | 97 | pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids); |
98 | #ifdef CONFIG_RCU_BOOST | ||
99 | pr_info("\tRCU kthread priority: %d.\n", kthread_prio); | ||
100 | #endif | ||
101 | } | 101 | } |
102 | 102 | ||
103 | #ifdef CONFIG_TREE_PREEMPT_RCU | 103 | #ifdef CONFIG_TREE_PREEMPT_RCU |
@@ -1339,7 +1339,7 @@ static int rcu_spawn_one_boost_kthread(struct rcu_state *rsp, | |||
1339 | smp_mb__after_unlock_lock(); | 1339 | smp_mb__after_unlock_lock(); |
1340 | rnp->boost_kthread_task = t; | 1340 | rnp->boost_kthread_task = t; |
1341 | raw_spin_unlock_irqrestore(&rnp->lock, flags); | 1341 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
1342 | sp.sched_priority = RCU_BOOST_PRIO; | 1342 | sp.sched_priority = kthread_prio; |
1343 | sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); | 1343 | sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); |
1344 | wake_up_process(t); /* get to TASK_INTERRUPTIBLE quickly. */ | 1344 | wake_up_process(t); /* get to TASK_INTERRUPTIBLE quickly. */ |
1345 | return 0; | 1345 | return 0; |
@@ -1356,7 +1356,7 @@ static void rcu_cpu_kthread_setup(unsigned int cpu) | |||
1356 | { | 1356 | { |
1357 | struct sched_param sp; | 1357 | struct sched_param sp; |
1358 | 1358 | ||
1359 | sp.sched_priority = RCU_KTHREAD_PRIO; | 1359 | sp.sched_priority = kthread_prio; |
1360 | sched_setscheduler_nocheck(current, SCHED_FIFO, &sp); | 1360 | sched_setscheduler_nocheck(current, SCHED_FIFO, &sp); |
1361 | } | 1361 | } |
1362 | 1362 | ||
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE03 b/tools/testing/selftests/rcutorture/configs/rcu/TREE03 index f4567fb3e332..b95f62efd6f2 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/TREE03 +++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE03 | |||
@@ -17,5 +17,5 @@ CONFIG_DEBUG_LOCK_ALLOC=n | |||
17 | CONFIG_RCU_CPU_STALL_INFO=n | 17 | CONFIG_RCU_CPU_STALL_INFO=n |
18 | CONFIG_RCU_CPU_STALL_VERBOSE=n | 18 | CONFIG_RCU_CPU_STALL_VERBOSE=n |
19 | CONFIG_RCU_BOOST=y | 19 | CONFIG_RCU_BOOST=y |
20 | CONFIG_RCU_BOOST_PRIO=2 | 20 | CONFIG_RCU_KTHREAD_PRIO=2 |
21 | CONFIG_DEBUG_OBJECTS_RCU_HEAD=n | 21 | CONFIG_DEBUG_OBJECTS_RCU_HEAD=n |
diff --git a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt index 3e588db86a17..ab6e7b4103ac 100644 --- a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt +++ b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt | |||
@@ -15,8 +15,8 @@ CONFIG_PREEMPT -- Do half. (First three and #8.) | |||
15 | CONFIG_PROVE_LOCKING -- Do all but two, covering CONFIG_PROVE_RCU and not. | 15 | CONFIG_PROVE_LOCKING -- Do all but two, covering CONFIG_PROVE_RCU and not. |
16 | CONFIG_PROVE_RCU -- Do all but one under CONFIG_PROVE_LOCKING. | 16 | CONFIG_PROVE_RCU -- Do all but one under CONFIG_PROVE_LOCKING. |
17 | CONFIG_RCU_BOOST -- one of TREE_PREEMPT_RCU. | 17 | CONFIG_RCU_BOOST -- one of TREE_PREEMPT_RCU. |
18 | CONFIG_RCU_BOOST_PRIO -- set to 2 for _BOOST testing. | 18 | CONFIG_RCU_KTHREAD_PRIO -- set to 2 for _BOOST testing. |
19 | CONFIG_RCU_CPU_STALL_INFO -- do one with and without _VERBOSE. | 19 | CONFIG_RCU_CPU_STALL_INFO -- Do one. |
20 | CONFIG_RCU_CPU_STALL_VERBOSE -- do one with and without _INFO. | 20 | CONFIG_RCU_CPU_STALL_VERBOSE -- do one with and without _INFO. |
21 | CONFIG_RCU_FANOUT -- Cover hierarchy as currently, but overlap with others. | 21 | CONFIG_RCU_FANOUT -- Cover hierarchy as currently, but overlap with others. |
22 | CONFIG_RCU_FANOUT_EXACT -- Do one. | 22 | CONFIG_RCU_FANOUT_EXACT -- Do one. |