Skip to content

Commit 6010d24

Browse files
Waiman-LongPeter Zijlstra
authored andcommitted
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1174b93 commit 6010d24

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

include/linux/sched/isolation.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77
#include <linux/tick.h>
88

99
enum hk_type {
10-
HK_TYPE_TIMER,
11-
HK_TYPE_RCU,
12-
HK_TYPE_MISC,
13-
HK_TYPE_TICK,
1410
HK_TYPE_DOMAIN,
15-
HK_TYPE_WQ,
1611
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
1925
};
2026

2127
#ifdef CONFIG_CPU_ISOLATION

kernel/sched/isolation.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@
99
*/
1010

1111
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),
1612
HK_FLAG_DOMAIN = BIT(HK_TYPE_DOMAIN),
17-
HK_FLAG_WQ = BIT(HK_TYPE_WQ),
1813
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),
2015
};
2116

2217
DEFINE_STATIC_KEY_FALSE(housekeeping_overridden);
@@ -96,7 +91,7 @@ void __init housekeeping_init(void)
9691

9792
static_branch_enable(&housekeeping_overridden);
9893

99-
if (housekeeping.flags & HK_FLAG_TICK)
94+
if (housekeeping.flags & HK_FLAG_KERNEL_NOISE)
10095
sched_tick_offload_init();
10196

10297
for_each_set_bit(type, &housekeeping.flags, HK_TYPE_MAX) {
@@ -120,7 +115,7 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
120115
unsigned int first_cpu;
121116
int err = 0;
122117

123-
if ((flags & HK_FLAG_TICK) && !(housekeeping.flags & HK_FLAG_TICK)) {
118+
if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERNEL_NOISE)) {
124119
if (!IS_ENABLED(CONFIG_NO_HZ_FULL)) {
125120
pr_warn("Housekeeping: nohz unsupported."
126121
" Build with CONFIG_NO_HZ_FULL\n");
@@ -176,7 +171,7 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
176171
housekeeping_setup_type(type, housekeeping_staging);
177172
}
178173

179-
if ((flags & HK_FLAG_TICK) && !(housekeeping.flags & HK_FLAG_TICK))
174+
if ((flags & HK_FLAG_KERNEL_NOISE) && !(housekeeping.flags & HK_FLAG_KERNEL_NOISE))
180175
tick_nohz_full_setup(non_housekeeping_mask);
181176

182177
housekeeping.flags |= flags;
@@ -194,8 +189,7 @@ static int __init housekeeping_nohz_full_setup(char *str)
194189
{
195190
unsigned long flags;
196191

197-
flags = HK_FLAG_TICK | HK_FLAG_WQ | HK_FLAG_TIMER | HK_FLAG_RCU |
198-
HK_FLAG_MISC | HK_FLAG_KTHREAD;
192+
flags = HK_FLAG_KERNEL_NOISE;
199193

200194
return housekeeping_setup(str, flags);
201195
}
@@ -214,8 +208,7 @@ static int __init housekeeping_isolcpus_setup(char *str)
214208
*/
215209
if (!strncmp(str, "nohz,", 5)) {
216210
str += 5;
217-
flags |= HK_FLAG_TICK | HK_FLAG_WQ | HK_FLAG_TIMER |
218-
HK_FLAG_RCU | HK_FLAG_MISC | HK_FLAG_KTHREAD;
211+
flags |= HK_FLAG_KERNEL_NOISE;
219212
continue;
220213
}
221214

0 commit comments

Comments
 (0)