[RFC PATCH 0/1] sched/isolation: Warn when maxcpus= is specified with nohz_full= or isolcpus=
From: Aaron Tomlin
Date: Sun Dec 01 2024 - 13:42:55 EST
Hi Oleg, Frederic, Peter,
I have seen a case where maxcpus=1 and e.g. nohz_full=1,3-31, was used to
force the CPU affinity of certain unbound or non CPU-specific kernel
threads at boot-time. Albeit, since commit 9cc5b8656892a ("isolcpus: Affine
unbound kernel threads to housekeeping cpus") this is handled entirely via
nohz_full=. I thought it might be worth adding a warning.
Aaron Tomlin (1):
sched/isolation: Warn when maxcpus= is specified with nohz_full= or
isolcpus=
kernel/sched/isolation.c | 2 ++
1 file changed, 2 insertions(+)
--
2.47.1
--
Aaron TomlinFrom 9d82eb9f9c0010025047c45754ec81c3832547e4 Mon Sep 17 00:00:00 2001
From: Aaron Tomlin <atomlin@xxxxxxxxxxx>
Date: Sat, 30 Nov 2024 23:31:39 +0000
Subject: [RFC PATCH 1/1] sched/isolation: Warn when maxcpus= is specified with
nohz_full= or isolcpus=
In the context of housekeeping_setup(), the use of maxcpus= does not
dictate how the housekeeping CPU mask is built i.e. only the "possible"
CPU mask and non-housekeeping CPU mask is considered. Indeed the
possible CPU mask is indicative of the CPU(s) that can be brought online
if they are physical present.
Some customers in the past have used maxcpus=1 e.g. with
nohz_full=1,3-31, to force the CPU affinity of certain unbound or non
CPU-specific kernel threads at boot-time. Albeit, since commit
9cc5b8656892a ("isolcpus: Affine unbound kernel threads to housekeeping
cpus") this is handled entirely via nohz_full=.
This patch adds a simple warning when maxcpus= and nohz_full= or
isolcpus= is specified. However, since commit 257bf89d84121
("sched/isolation: Fix boot crash when maxcpus < first housekeeping
CPU") maxcpus=1 and an unsuitable nohz_full= reading is handled
appropriately now.
Signed-off-by: Aaron Tomlin <atomlin@xxxxxxxxxxx>
---
kernel/sched/isolation.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 5891e715f00d..27cdc711dcf5 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -138,6 +138,8 @@ static int __init housekeeping_setup(char *str, unsigned long flags)
alloc_bootmem_cpumask_var(&housekeeping_staging);
cpumask_andnot(housekeeping_staging,
cpu_possible_mask, non_housekeeping_mask);
+ if (setup_max_cpus != NR_CPUS)
+ pr_warn("Housekeeping: maxcpus= has been specified too\n");
first_cpu = cpumask_first_and(cpu_present_mask, housekeeping_staging);
if (first_cpu >= nr_cpu_ids || first_cpu >= setup_max_cpus) {
--
2.47.1