From: Ibrahim Elshahed <lshahed@amazon.de>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: 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: [PATCH 0/2] sched/core: Fix stale core_pick and forced idle after SM_IDLE fast path
Date: Tue, 17 Nov 2026 14:27:01 +0000 [thread overview]
Message-ID: <20261117142704.6878-1-lshahed@amazon.de> (raw)
Under core scheduling, a core-wide selection can leave a pick for an
idle sibling in rq->core_pick and force the other sibling idle. If the
picked task is migrated away before the idle sibling schedules, and it
was that sibling's only task, the SM_IDLE fast path (v6.12+) sends the
sibling back to idle without consuming the pick. The core then stays
forced idle with nothing running, and the forced idle accounting keeps
using the stale pointer, also after the task and its cgroup are freed.
Patch 1 clears rq->core_pick when the picked task is dequeued. Patch 2
stops idle CPUs from taking the SM_IDLE fast path while core scheduling
still has a pick or forced idle to settle.
Testing, on tip sched/core d7e670601af6, schedstats=enable:
- KVM guest, 2 cores x 2 threads, idle=halt. A test init wakes a
SCHED_FIFO task with its own cookie and cgroup on CPU1 while a
cookied task yields on CPU0, migrates it to CPU2 0-50 us later, and
checks that CPU0 is stuck forced idle. It then kills the task,
removes its cgroup, waits 100 ms and wakes a task on CPU1.
Without the series all 6 boots hit:
BUG: unable to handle page fault for address: ffffa3511fcbc018
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
RIP: 0010:__cgroup_account_cputime_field+0x51/0x70
Call Trace:
__sched_core_account_forceidle+0x14a/0x180
__schedule+0x105d/0x19a0
schedule_idle+0x1e/0x40
cpu_startup_entry+0x24/0x30
start_secondary+0xf3/0x100
With the series, 6 boots of 240 s (about 1M attempts) showed no
stuck forced idle and no oops.
- Bare metal, Intel Xeon Platinum 8375C, 128 CPUs, 2 threads per core.
The same churn on 32 SMT pairs for 300 s, counting a stall when the
yielding task makes no progress for 5 ms: 41 stalls in 123036
attempts without the series, 0 in 109745 with it. dmesg clean on
both, forced idle counters still increasing.
- Builds with SCHED_CORE on and off, SCHEDSTATS on and off,
SCHED_CLASS_EXT, PREEMPT_RT, tinyconfig and allnoconfig, W=1 clean
in kernel/sched/.
- Each patch builds on its own (kernel/sched/ with SCHED_CORE on and
off, W=1).
I will reply with the test programs.
Ibrahim Elshahed (2):
sched/core: Clear a stale rq->core_pick after dequeue
sched/core: Don't skip a pending core-wide pick on idle re-entry
kernel/sched/core.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
--
2.47.3
next reply other threads:[~2026-11-17 14:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:27 Ibrahim Elshahed [this message]
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-17 14:27 ` [PATCH 0/2] sched/core: Fix stale core_pick and forced idle after SM_IDLE fast path Ibrahim Elshahed
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=20261117142704.6878-1-lshahed@amazon.de \
--to=lshahed@amazon.de \
--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=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=nh-open-source@amazon.com \
--cc=peterz@infradead.org \
--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®