From: Thomas Gleixner <tglx@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>,
Jiakai Xu <xujiakai24@mails.ucas.ac.cn>
Cc: 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>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/mmcid: Bound the CID allocation busy wait
Date: Thu, 15 Oct 2026 22:37:30 +0200 [thread overview]
Message-ID: <877bjiem45.ffs@fw13> (raw)
In-Reply-To: <20260918104349.GL776954@noisy.programming.kicks-ass.net>
On Fri, Sep 18 2026 at 12:43, Peter Zijlstra wrote:
>> This also prevents an exhausted allocation from feeding MM_CID_UNSET
>> into the transition bit handling, which would later hand MM_CID_UNSET
>> as bit number to clear_bit().
>
> This all sounds horribly wrong. It fails to explain why the transition
> isn't happening, nor does it explain how it doesn't utterly
> violate/break user space.
Correct. Going back to user space without a CID is broken.
Looking at the stall splat the scenario is:
CPU1 runs a jump label update and is stuck in csd_lock_wait(), which is
invoked from on_each_cpu_cond_mask(), smp_text_poke_sync_each_cpu().
That does not make progress because CPU0 is looping in mm_get_cid() with
interrupts disabled.
CPU0 runs an execve() and loops in mm_get_cid(), which is invoked from
sched_mm_cid_fork(), sched_mm_cid_after_execve().
RIP: 0010:mm_get_cid linux-7.1.13/kernel/sched/sched.h:3880 [inline]
RIP: 0010:sched_mm_cid_fork linux-7.1.13/kernel/sched/core.c:10970
So yes, that's 7.1.13, which is EOL, but it has all the mmcid fixes and
the same issue should reproduce on 7.3-rc7...
Jiakai, can you please provide the reproducer for this issue and
validate that it still persists on the lastest upstream kernel (7.3-rc7)?
The stall makes no sense because mm_get_cid() is invoked from:
10967 /* First user ? */
10968 if (!mm->mm_cid.users) {
10969 sched_mm_cid_add_user(t, mm);
10970 t->mm_cid.cid = mm_get_cid(mm);
which means this is the first CID user on the MM. So how can the bitmap
be exhausted?
I have a suspicion but it does not add up (yet).
This is a two CPU VM. Assume that the process which invokes execve() has
more than two threads. That means the MMCID of the process is in per CPU
mode. sched_mm_cid_exit() ignores a mode change when the last user goes
away and with two CPUs the threshold to switch back is when the user
count goes below _ONE_. So there is probably stale state there, but the
last outgoing task should have reclaimed the per CPU CID and dropped it,
but the other CPU still has it assigned to it. So that first allocation
should succeed...
I'll try to write a trivial test program tomorrow which creates enough
threads and does an execve().
Thanks,
tglx
prev parent reply other threads:[~2026-10-15 20:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 1:34 Jiakai Xu
2026-09-18 10:43 ` Peter Zijlstra
2026-10-15 20:37 ` Thomas Gleixner [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=877bjiem45.ffs@fw13 \
--to=tglx@linutronix.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=xujiakai24@mails.ucas.ac.cn \
/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
all inboxes | Powered by JetHome®