Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>,
	Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()
Date: Fri, 27 Nov 2026 17:10:34 -0500	[thread overview]
Message-ID: <20261127171034.60e9de0c@gandalf.local.home> (raw)

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


             reply	other threads:[~2026-11-27 22:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 22:10 Steven Rostedt [this message]
2026-11-27 22:16 ` [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id() sashiko-bot
2026-11-27 22:23   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127171034.60e9de0c@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox