Skip to content

Skip nodes without CPUs in the sched_ext idle walk

Cheng-Yang Chou linux-arch linux-mm sched-ext 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 2 repliesSuperseded

Changes in v2 from the cover letter

- 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/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/fake-numa: map each CPU only to its own nodearch/x86/mm/numa.c include/asm-generic/numa.h mm/arch_numa.c +1 more+3 -980 replies
2/2sched_ext/idle: Skip nodes without CPUskernel/sched/ext/idle.c+2 -21 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 mm and sched_ext/for-7.5 0/2] Skip nodes without CPUs in the sched_ext idle walk

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/[email protected]/

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/[email protected]/

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

Signature · 1 line
2.56.0