From: Juri Lelli <juri.lelli@redhat.com>
To: Elkin Cruz <elkin@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
irogers@google.com, stable@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] sched/core: Avoid atomic cpuset_lock() in __sched_setscheduler()
Date: Thu, 26 Nov 2026 12:12:05 +0100 [thread overview]
Message-ID: <awgUBa_9VrhDahUt@jlelli-thinkpadt14gen4.remote.csb> (raw)
In-Reply-To: <20261125222729.1450842-1-elkin@google.com>
Hello,
On 25/11/26 22:27, Elkin Cruz wrote:
> When Magic SysRq-N invokes normalize_rt_tasks(), it holds
> read_lock(&tasklist_lock) in atomic context and calls
> __sched_setscheduler(p, &attr, false, false) with pi == false to reset
> real-time and deadline tasks to SCHED_NORMAL.
>
> For a SCHED_DEADLINE task, dl_policy(p->policy) is true, so
> __sched_setscheduler() calls cpuset_lock() (mutex_lock(&cpuset_mutex))
> while in atomic context under tasklist_lock and then skips
> cpuset_unlock() on exit because unlocking is gated on if (pi), leaving
> cpuset_mutex permanently locked.
>
> Guard cpuset_lock() with pi (matching the non-atomic caller contract,
> where switched_from_dl() releases deadline utilization under rq/dl_bw
> spinlocks) and call cpuset_unlock() on exit whenever cpuset_locked is
> set.
>
> Fixes: 111cd11bbc54 ("sched/cpuset: Bring back cpuset_mutex")
> Signed-off-by: Elkin Cruz <elkin@google.com>
> Cc: stable@vger.kernel.org
> ---
>
> I am trying out new Clang static analysis checks for kernel bug
> classes, and they flagged this code as possibly buggy. The findings
> were triaged/fixed and commit descriptions were drafted with help of AI,
> then checked against linux-next (not runtime-tested on hardware).
Thanks for this, but I believe Mathieu's patch takes care of it already?
https://lore.kernel.org/lkml/9194486f15bb0cb36b51e4525f471d1150c0d58b.1795115075.git.mathieu.desnoyers@efficios.com/
Best,
Juri
prev parent reply other threads:[~2026-11-26 11:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 22:27 [PATCH] sched/core: Avoid atomic cpuset_lock() in __sched_setscheduler() Elkin Cruz
2026-11-26 11:12 ` Juri Lelli [this message]
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=awgUBa_9VrhDahUt@jlelli-thinkpadt14gen4.remote.csb \
--to=juri.lelli@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=elkin@google.com \
--cc=irogers@google.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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