mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] sched/core: Fix stale core_pick and forced idle after SM_IDLE fast path
@ 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
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ibrahim Elshahed @ 2026-11-17 14:27 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak, Josh Don, linux-kernel,
	nh-open-source, Fernand Sieber, Roman Kagan

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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-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

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®