Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Clark Williams and committed by
Paul E. McKenney
21871d7e e0775cef

+32 -24
+7
Documentation/kernel-parameters.txt
··· 2922 2922 quiescent states. Units are jiffies, minimum 2923 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 2932 rcutree.rcu_nocb_leader_stride= [KNL] 2926 2933 Set the number of NOCB kthread groups, which 2927 2934 defaults to the square root of the number of
+12 -11
init/Kconfig
··· 672 672 Say Y here if you are working with real-time apps or heavy loads 673 673 Say N here if you are unsure. 674 674 675 - config RCU_BOOST_PRIO 676 - int "Real-time priority to boost RCU readers to" 675 + config RCU_KTHREAD_PRIO 676 + int "Real-time priority to use for RCU worker threads" 677 677 range 1 99 678 678 depends on RCU_BOOST 679 679 default 1 680 680 help 681 - This option specifies the real-time priority to which long-term 682 - preempted RCU readers are to be boosted. If you are working 683 - with a real-time application that has one or more CPU-bound 684 - threads running at a real-time priority level, you should set 685 - RCU_BOOST_PRIO to a priority higher then the highest-priority 686 - real-time CPU-bound thread. The default RCU_BOOST_PRIO value 687 - of 1 is appropriate in the common case, which is real-time 681 + This option specifies the SCHED_FIFO priority value that will be 682 + assigned to the rcuc/n and rcub/n threads and is also the value 683 + used for RCU_BOOST (if enabled). If you are working with a 684 + real-time application that has one or more CPU-bound threads 685 + running at a real-time priority level, you should set 686 + RCU_KTHREAD_PRIO to a priority higher than the highest-priority 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 689 applications that do not have any CPU-bound threads. 689 690 690 691 Some real-time applications might not have a single real-time 691 692 thread that saturates a given CPU, but instead might have 692 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 695 a priority higher than the lowest-priority thread that is 695 696 conspiring to prevent the CPU from running any non-real-time 696 697 tasks. For example, if one thread at priority 10 and another 697 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 700 set to priority 6 or higher. 700 701 701 702 Specify the real-time priority, or take the default if unsure.
+10 -10
kernel/rcu/tree_plugin.h
··· 30 30 #include <linux/smpboot.h> 31 31 #include "../time/tick-internal.h" 32 32 33 - #define RCU_KTHREAD_PRIO 1 34 - 35 33 #ifdef CONFIG_RCU_BOOST 36 34 37 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 42 * Control variables for per-CPU and per-rcu_node kthreads. These ··· 47 46 DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops); 48 47 DEFINE_PER_CPU(char, rcu_cpu_has_work); 49 48 50 - #else /* #ifdef CONFIG_RCU_BOOST */ 51 - 52 - #define RCU_BOOST_PRIO RCU_KTHREAD_PRIO 53 - 54 - #endif /* #else #ifdef CONFIG_RCU_BOOST */ 49 + #endif /* #ifdef CONFIG_RCU_BOOST */ 55 50 56 51 #ifdef CONFIG_RCU_NOCB_CPU 57 52 static cpumask_var_t rcu_nocb_mask; /* CPUs to have callbacks offloaded. */ ··· 95 98 pr_info("\tBoot-time adjustment of leaf fanout to %d.\n", rcu_fanout_leaf); 96 99 if (nr_cpu_ids != NR_CPUS) 97 100 pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids); 101 + #ifdef CONFIG_RCU_BOOST 102 + pr_info("\tRCU kthread priority: %d.\n", kthread_prio); 103 + #endif 98 104 } 99 105 100 106 #ifdef CONFIG_TREE_PREEMPT_RCU ··· 1339 1339 smp_mb__after_unlock_lock(); 1340 1340 rnp->boost_kthread_task = t; 1341 1341 raw_spin_unlock_irqrestore(&rnp->lock, flags); 1342 - sp.sched_priority = RCU_BOOST_PRIO; 1342 + sp.sched_priority = kthread_prio; 1343 1343 sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); 1344 1344 wake_up_process(t); /* get to TASK_INTERRUPTIBLE quickly. */ 1345 1345 return 0; ··· 1356 1356 { 1357 1357 struct sched_param sp; 1358 1358 1359 - sp.sched_priority = RCU_KTHREAD_PRIO; 1359 + sp.sched_priority = kthread_prio; 1360 1360 sched_setscheduler_nocheck(current, SCHED_FIFO, &sp); 1361 1361 } 1362 1362
+1 -1
tools/testing/selftests/rcutorture/configs/rcu/TREE03
··· 17 17 CONFIG_RCU_CPU_STALL_INFO=n 18 18 CONFIG_RCU_CPU_STALL_VERBOSE=n 19 19 CONFIG_RCU_BOOST=y 20 - CONFIG_RCU_BOOST_PRIO=2 20 + CONFIG_RCU_KTHREAD_PRIO=2 21 21 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+2 -2
tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt
··· 15 15 CONFIG_PROVE_LOCKING -- Do all but two, covering CONFIG_PROVE_RCU and not. 16 16 CONFIG_PROVE_RCU -- Do all but one under CONFIG_PROVE_LOCKING. 17 17 CONFIG_RCU_BOOST -- one of TREE_PREEMPT_RCU. 18 - CONFIG_RCU_BOOST_PRIO -- set to 2 for _BOOST testing. 19 - CONFIG_RCU_CPU_STALL_INFO -- do one with and without _VERBOSE. 18 + CONFIG_RCU_KTHREAD_PRIO -- set to 2 for _BOOST testing. 19 + CONFIG_RCU_CPU_STALL_INFO -- Do one. 20 20 CONFIG_RCU_CPU_STALL_VERBOSE -- do one with and without _INFO. 21 21 CONFIG_RCU_FANOUT -- Cover hierarchy as currently, but overlap with others. 22 22 CONFIG_RCU_FANOUT_EXACT -- Do one.