[PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()

From: Steven Rostedt

Date: Fri Nov 27 2026 - 17:10:45 EST


From: Steven Rostedt <rostedt@xxxxxxxxxxx>

When isolation is not enabled, houeskeeping_any_cpu() returns the current
CPU via smp_processor_id(). If this is called from a preemptable context,
it triggers a WARN_ON():

BUG: using smp_processor_id() in preemptible [00000000] code: ftracetest/21785

As the function is to return any CPU that is for house keeping, it
doesn't make sense to require it to be called from a non preemptable
context as the result is not guaranteed to return the current CPU anyway.

Use raw_smp_processor_id() to suppress the warning.

Fixes: 7863406143d8b ("sched/isolation: Move housekeeping related code to its own file")
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
include/linux/sched/isolation.h | 2 +-
kernel/sched/isolation.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index cf0fd03dd7a2..81617d5c8e69 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -50,7 +50,7 @@ extern void __init housekeeping_init(void);

static inline int housekeeping_any_cpu(enum hk_type type)
{
- return smp_processor_id();
+ return raw_smp_processor_id();
}

static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 156025ef81b7..c1c84d72c7c5 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -99,7 +99,7 @@ int housekeeping_any_cpu(enum hk_type type)
type != HK_TYPE_TIMER);
}
}
- return smp_processor_id();
+ return raw_smp_processor_id();
}
EXPORT_SYMBOL_GPL(housekeeping_any_cpu);

--
2.53.0