Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()
@ 2026-11-27 22:10 Steven Rostedt
  2026-11-27 22:16 ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2026-11-27 22:10 UTC (permalink / raw)
  To: LKML, Linux Trace Kernel
  Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Thomas Gleixner

From: Steven Rostedt <rostedt@goodmis.org>

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@goodmis.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-27 22:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 22:10 [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id() Steven Rostedt
2026-11-27 22:16 ` sashiko-bot
2026-11-27 22:23   ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox