Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 mm and sched_ext/for-7.5 0/2] Skip nodes without CPUs in the sched_ext idle walk
@ 2026-12-01  9:18 Cheng-Yang Chou
  2026-12-01  9:18 ` [PATCH v2 mm and sched_ext/for-7.5 1/2] mm/fake-numa: map each CPU only to its own node Cheng-Yang Chou
  2026-12-01  9:18 ` [PATCH v2 mm and sched_ext/for-7.5 2/2] sched_ext/idle: Skip nodes without CPUs Cheng-Yang Chou
  0 siblings, 2 replies; 4+ messages in thread
From: Cheng-Yang Chou @ 2026-12-01  9:18 UTC (permalink / raw)
  To: sched-ext, Tejun Heo, David Vernet, Andrea Righi, Changwoo Min,
	linux-mm, Andrew Morton, Mike Rapoport
  Cc: Ching-Chun Huang, Chia-Ping Tsai, Dave Hansen, Andy Lutomirski,
	Peter Zijlstra, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H . Peter Anvin, x86, Arnd Bergmann, linux-arch, chengyang.chou,
	Cheng-Yang Chou

With numa=fake, NUMA emulation sets a CPU in cpumask_of_node() of every
emulated node on its physical node, while cpu_to_node() returns only
one of them. On a Raspberry Pi 5, whose firmware adds numa=fake=8, all
eight nodes list CPUs 0-3 and have N_CPU set, but cpu_to_node() is 0
for every CPU. sched_ext's per-node idle walk then visits seven nodes
that can't have an idle CPU.

As Tejun suggested [1], patch 1 makes NUMA emulation set a CPU only in
the cpumask of its own node, and patch 2 makes sched_ext walk
node_states[N_CPU] instead of N_ONLINE.

On the rpi5 under hackbench, the per-node ops.select_cpu() time goes
from 484ns to 141ns, against 139ns with the global idle cpumask.

This series is based on sched_ext/for-7.5. Patch 1 also applies cleanly
to memblock/for-next.

[1] https://lore.kernel.org/all/e89bc79ed200cc40699ad62bb3d762b7@kernel.org/

Changes in v2:
- Fix NUMA emulation and walk N_CPU instead of keeping a separate node
  mask in sched_ext. (Tejun)
- Link to v1:
  https://lore.kernel.org/all/20261129163536.15478-1-yphbchou0911@gmail.com/

Cheng-Yang Chou (2):
  mm/fake-numa: map each CPU only to its own node
  sched_ext/idle: Skip nodes without CPUs

 arch/x86/mm/numa.c         |  4 ---
 include/asm-generic/numa.h |  4 ---
 kernel/sched/ext/idle.c    |  4 +--
 mm/arch_numa.c             | 26 ---------------
 mm/numa_emulation.c        | 67 ++------------------------------------
 5 files changed, 5 insertions(+), 100 deletions(-)


base-commit: 95a4df9944cd5d57a92662269114ba99cb972394
-- 
2.56.0



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

end of thread, other threads:[~2026-12-01 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  9:18 [PATCH v2 mm and sched_ext/for-7.5 0/2] Skip nodes without CPUs in the sched_ext idle walk Cheng-Yang Chou
2026-12-01  9:18 ` [PATCH v2 mm and sched_ext/for-7.5 1/2] mm/fake-numa: map each CPU only to its own node Cheng-Yang Chou
2026-12-01  9:18 ` [PATCH v2 mm and sched_ext/for-7.5 2/2] sched_ext/idle: Skip nodes without CPUs Cheng-Yang Chou
2026-12-01 15:45   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox