From: Peter Zijlstra <peterz@infradead.org>
To: Ibrahim Elshahed <lshahed@amazon.de>
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>,
Josh Don <joshdon@google.com>,
linux-kernel@vger.kernel.org, nh-open-source@amazon.com,
Fernand Sieber <sieberf@amazon.com>,
Roman Kagan <rkagan@amazon.de>
Subject: Re: [PATCH 0/2] sched/core: Fix stale core_pick and forced idle after SM_IDLE fast path
Date: Wed, 18 Nov 2026 15:41:49 +0100 [thread overview]
Message-ID: <20261118144149.GA1779021@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261117142704.6878-4-lshahed@amazon.de>
On Tue, Nov 17, 2026 at 02:27:04PM +0000, Ibrahim Elshahed wrote:
> Here are the two test programs used for the numbers in the cover letter.
>
> 1. init.c runs as PID 1 in a KVM guest with one socket, two cores and
> two threads (CPUs 0 and 1 are one core). A cookied task yields on
> CPU0. Each attempt wakes a SCHED_FIFO task with another cookie, in
> its own cgroup, on CPU1 and migrates it to CPU2 0-50 us later. If
> the yielding task then makes no progress for 20 ms, the core is
> stuck forced idle ("STALE"): the program kills the task, removes its
> cgroup, waits 100 ms without touching CPUs 0 and 1, and wakes a task
> on CPU1. Without the series that reschedule oopses in
> __cgroup_account_cputime_field(). mode=nomigrate is a control that
> never migrates the woken task.
>
> Build and run:
>
> gcc -O2 -static -o init init.c
> mkdir -p root/dev root/proc root/sys/fs/cgroup && cp init root/
> (cd root && find . | cpio -o -H newc | gzip) > initramfs.cpio.gz
> qemu-system-x86_64 -enable-kvm -cpu host -m 2G -nographic -no-reboot \
> -smp 4,sockets=1,cores=2,threads=2 \
> -kernel bzImage -initrd initramfs.cpio.gz \
> -append "schedstats=enable idle=halt console=ttyS0 panic=-1 mode=migrate secs=240"
>
> The kernel needs CONFIG_SCHED_CORE, CONFIG_SCHEDSTATS, CONFIG_SCHED_SMT,
> CONFIG_CGROUP_SCHED and CONFIG_FAIR_GROUP_SCHED.
>
> 2. cschurn.c runs the same churn on bare metal on half of the SMT cores,
> using the other half as migration targets, and counts a stall when
> the yielding task makes no progress for 5 ms. It frees each woken
> task and its cgroup shortly after the check (2 ms by default, second
> argument), so it shows the stuck forced idle but not the
> use-after-free.
>
> gcc -O2 -o cschurn cschurn.c
> ./cschurn 300 # as root, cgroup2 at /sys/fs/cgroup,
> # kernel booted with schedstats=enable
>
Does it make sense to stick these in the selftests thing?
prev parent reply other threads:[~2026-11-18 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:27 Ibrahim Elshahed
2026-11-17 14:27 ` [PATCH 1/2] sched/core: Clear a stale rq->core_pick after dequeue Ibrahim Elshahed
2026-11-17 14:27 ` [PATCH 2/2] sched/core: Don't skip a pending core-wide pick on idle re-entry Ibrahim Elshahed
2026-11-18 14:40 ` Peter Zijlstra
2026-11-17 14:27 ` [PATCH 0/2] sched/core: Fix stale core_pick and forced idle after SM_IDLE fast path Ibrahim Elshahed
2026-11-18 14:41 ` Peter Zijlstra [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=20261118144149.GA1779021@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joshdon@google.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lshahed@amazon.de \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=nh-open-source@amazon.com \
--cc=rkagan@amazon.de \
--cc=rostedt@goodmis.org \
--cc=sieberf@amazon.com \
--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
all inboxes | Powered by JetHome®