Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Steven Rostedt" <rostedt@goodmis.org>,
	"Linux Trace Kernel" <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()
Date: Fri, 27 Nov 2026 22:16:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-238322@kernel.org> (raw)
In-Reply-To: <20261127171034.60e9de0c@gandalf.local.home>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/isolation: housekeeping_any_cpu() still warns in
  preemptible context
--

commit c1392718dea3b288dab2eb1637739fbba4e0fc9a
Author: Steven Rostedt <rostedt@goodmis.org>

sched/isolation: Have housekeeping_any_cpu() use raw_smp_processor_id()

This commit replaces smp_processor_id() with raw_smp_processor_id() in
 the housekeeping_any_cpu() fallback returns so that callers in preemptible
context do not trigger preemption warnings when isolation is not enabled.

> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> index 156025ef81b75..c1c84d72c7c5b 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);

[Severity: Medium]
Can housekeeping_any_cpu() still trigger CONFIG_DEBUG_PREEMPT warnings when
called from a preemptible context with CPU isolation enabled?

When housekeeping_overridden is active and housekeeping.flags has the
requested type set, housekeeping_any_cpu() takes the branch above this
fallback:

kernel/sched/isolation.c:housekeeping_any_cpu() {
	if (static_branch_unlikely(&housekeeping_overridden)) {
		if (housekeeping.flags & BIT(type)) {
			cpu = sched_numa_find_closest(housekeeping_cpumask(type), smp_processor_id());
			if (cpu < nr_cpu_ids)
				return cpu;

			cpu = cpumask_any_and_distribute(housekeeping_cpumask(type), cpu_online_mask);
}

That path still passes smp_processor_id() to sched_numa_find_closest(), and
both sched_numa_find_closest() (under rcu_read_lock(), which remains
preemptible on CONFIG_PREEMPT_RCU kernels) and the fallback call
cpumask_any_and_distribute(), which uses __this_cpu_read() and
__this_cpu_write() on distribute_cpu_mask_prev.  A preemptible caller such
as ring_buffer_poll_remote() -> rb_wakeups() -> rb_irq_work_queue() on a
system booted with nohz_full= will therefore still hit smp_processor_id()
and __this_cpu_read() preemption splats.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127171034.60e9de0c@gandalf.local.home?part=1

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=sashiko-outbox-238322@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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