From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
linux-kernel@vger.kernel.org,
syzbot <syzbot+6835d5c11145e4f77057@syzkaller.appspotmail.com>,
Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
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>
Subject: Re: [PATCH v3] sched: Reset cpumask if __migrate_task() failed for migration_cpu_stop()
Date: Thu, 3 Dec 2026 18:42:46 +0100 [thread overview]
Message-ID: <20261203174246.q5_fUNj8@linutronix.de> (raw)
In-Reply-To: <20261203153738.GF83911@noisy.programming.kicks-ass.net>
On 2026-12-03 16:37:38 [+0100], Peter Zijlstra wrote:
> > \o/
> >
> > OK, let me go split this into a few patches and commit somewhere.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/urgent
Still works. Mind to fold the snippet at the bottom?
I don't hit the corner case:
|__set_cpus_allowed_ptr_locked()
|{
…
| dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, ctx->new_mask);
| if (dest_cpu >= nr_cpu_ids) {
| ret = -EINVAL;
| goto out;
| }
…
|}
from ___migrate_enable() and I'm not sure why that is. It might be
because the CPU mask is never invalid to begin with in this test case.
But a CPU affinity change from userland on a thread which is in a
mg-disabled section might do this.
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 54df37f18ba0e..514c4b5290244 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3341,9 +3341,9 @@ void force_compatible_cpus_allowed_ptr(struct task_struct *p)
alloc_cpumask_var(&new_mask, GFP_KERNEL);
/*
- * __migrate_task() can fail silently in the face of concurrent
- * offlining of the chosen destination CPU, so take the hotplug
- * lock to ensure that the migration succeeds.
+ * migration_cpu_stop() can silently choose a different CPU in the face
+ * of concurrent offlining of the chosen destination CPU, so take the
+ * hotplug lock to ensure that the migration succeeds.
*/
cpus_read_lock();
if (!cpumask_available(new_mask))
Sebastian
next prev parent reply other threads:[~2026-12-03 17:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 17:16 [PATCH v3] sched: Reset cpumask if __migrate_task() failed for migration_cpu_stop() Sebastian Andrzej Siewior
2026-11-21 13:20 ` Karl Mehltretter
2026-11-21 14:39 ` Karl Mehltretter
2026-11-25 17:20 ` Peter Zijlstra
2026-11-25 19:37 ` Sebastian Andrzej Siewior
2026-11-26 10:40 ` Peter Zijlstra
2026-11-28 17:24 ` Karl Mehltretter
2026-12-02 14:26 ` Sebastian Andrzej Siewior
2026-12-02 14:42 ` Peter Zijlstra
2026-12-03 1:50 ` Karl Mehltretter
2026-12-03 13:05 ` Peter Zijlstra
2026-12-03 14:19 ` Sebastian Andrzej Siewior
2026-12-03 14:33 ` Peter Zijlstra
2026-12-03 15:37 ` Peter Zijlstra
2026-12-03 17:42 ` Sebastian Andrzej Siewior [this message]
2026-12-04 11:04 ` Peter Zijlstra
2026-12-04 1:44 ` Karl Mehltretter
2026-12-04 12:44 ` Peter Zijlstra
2026-12-05 3:50 ` Karl Mehltretter
2026-12-02 14:12 ` Sebastian Andrzej Siewior
2026-12-03 11:25 ` Zhen Wang
2026-12-03 12:05 ` Sebastian Andrzej Siewior
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=20261203174246.q5_fUNj8@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kmehltretter@gmail.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=radu@rendec.net \
--cc=rostedt@goodmis.org \
--cc=syzbot+6835d5c11145e4f77057@syzkaller.appspotmail.com \
--cc=tglx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.