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

Configure Feed

Select the types of activity you want to include in your feed.

sched/isolation: Consolidate housekeeping cpumasks that are always identical

The housekeeping cpumasks are only set by two boot commandline
parameters: "nohz_full" and "isolcpus". When there is more than one of
"nohz_full" or "isolcpus", the extra ones must have the same CPU list
or the setup will fail partially.

The HK_TYPE_DOMAIN and HK_TYPE_MANAGED_IRQ types are settable by
"isolcpus" only and their settings can be independent of the other
types. The other housekeeping types are all set by "nohz_full" or
"isolcpus=nohz" without a way to set them individually. So they all
have identical cpumasks.

There is actually no point in having different cpumasks for these
"nohz_full" only housekeeping types. Consolidate these types to use the
same cpumask by aliasing them to the same value. If there is a need to
set any of them independently in the future, we can break them out to
their own cpumasks again.

With this change, the number of cpumasks in the housekeeping structure
drops from 9 to 3. Other than that, there should be no other functional
change.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20241030175253.125248-4-longman@redhat.com

authored by

Waiman Long and committed by
Peter Zijlstra
6010d245 1174b934

+19 -20
+13 -7
include/linux/sched/isolation.h
··· 7 7 #include <linux/tick.h> 8 8 9 9 enum hk_type { 10 - HK_TYPE_TIMER, 11 - HK_TYPE_RCU, 12 - HK_TYPE_MISC, 13 - HK_TYPE_TICK, 14 10 HK_TYPE_DOMAIN, 15 - HK_TYPE_WQ, 16 11 HK_TYPE_MANAGED_IRQ, 17 - HK_TYPE_KTHREAD, 18 - HK_TYPE_MAX 12 + HK_TYPE_KERNEL_NOISE, 13 + HK_TYPE_MAX, 14 + 15 + /* 16 + * The following housekeeping types are only set by the nohz_full 17 + * boot commandline option. So they can share the same value. 18 + */ 19 + HK_TYPE_TICK = HK_TYPE_KERNEL_NOISE, 20 + HK_TYPE_TIMER = HK_TYPE_KERNEL_NOISE, 21 + HK_TYPE_RCU = HK_TYPE_KERNEL_NOISE, 22 + HK_TYPE_MISC = HK_TYPE_KERNEL_NOISE, 23 + HK_TYPE_WQ = HK_TYPE_KERNEL_NOISE, 24 + HK_TYPE_KTHREAD = HK_TYPE_KERNEL_NOISE 19 25 }; 20 26 21 27 #ifdef CONFIG_CPU_ISOLATION
+6 -13
kernel/sched/isolation.c
··· 9 9 */ 10 10 11 11 enum hk_flags { 12 - HK_FLAG_TIMER = BIT(HK_TYPE_TIMER), 13 - HK_FLAG_RCU = BIT(HK_TYPE_RCU), 14 - HK_FLAG_MISC = BIT(HK_TYPE_MISC), 15 - HK_FLAG_TICK = BIT(HK_TYPE_TICK), 16 12 HK_FLAG_DOMAIN = BIT(HK_TYPE_DOMAIN), 17 - HK_FLAG_WQ = BIT(HK_TYPE_WQ), 18 13 HK_FLAG_MANAGED_IRQ = BIT(HK_TYPE_MANAGED_IRQ), 19 - HK_FLAG_KTHREAD = BIT(HK_TYPE_KTHREAD), 14 + HK_FLAG_KERNEL_NOISE = BIT(HK_TYPE_KERNEL_NOISE), 20 15 }; 21 16 22 17 DEFINE_STATIC_KEY_FALSE(housekeeping_overridden); ··· 91 96 92 97 static_branch_enable(&housekeeping_overridden); 93 98 94 - if (housekeeping.flags & HK_FLAG_TICK) 99 + if (housekeeping.flags & HK_FLAG_KERNEL_NOISE) 95 100 sched_tick_offload_init(); 96 101 97 102 for_each_set_bit(type, &housekeeping.flags, HK_TYPE_MAX) { ··· 115 120 unsigned int first_cpu; 116 121 int err = 0; 117 122 118 - if ((flags & HK_FLAG_TICK) && !(housekeeping.flags & HK_FLAG_TICK)) { 123 + if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERNEL_NOISE)) { 119 124 if (!IS_ENABLED(CONFIG_NO_HZ_FULL)) { 120 125 pr_warn("Housekeeping: nohz unsupported." 121 126 " Build with CONFIG_NO_HZ_FULL\n"); ··· 171 176 housekeeping_setup_type(type, housekeeping_staging); 172 177 } 173 178 174 - if ((flags & HK_FLAG_TICK) && !(housekeeping.flags & HK_FLAG_TICK)) 179 + if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERNEL_NOISE)) 175 180 tick_nohz_full_setup(non_housekeeping_mask); 176 181 177 182 housekeeping.flags |= flags; ··· 189 194 { 190 195 unsigned long flags; 191 196 192 - flags = HK_FLAG_TICK | HK_FLAG_WQ | HK_FLAG_TIMER | HK_FLAG_RCU | 193 - HK_FLAG_MISC | HK_FLAG_KTHREAD; 197 + flags = HK_FLAG_KERNEL_NOISE; 194 198 195 199 return housekeeping_setup(str, flags); 196 200 } ··· 208 214 */ 209 215 if (!strncmp(str, "nohz,", 5)) { 210 216 str += 5; 211 - flags |= HK_FLAG_TICK | HK_FLAG_WQ | HK_FLAG_TIMER | 212 - HK_FLAG_RCU | HK_FLAG_MISC | HK_FLAG_KTHREAD; 217 + flags |= HK_FLAG_KERNEL_NOISE; 213 218 continue; 214 219 } 215 220