Skip to content

RFC sched: NUMA-aware concurrency IDs

Mathieu Desnoyers linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5lib: Implement find_{first,next,nth}_notandnot_bit, find_first_andnot_bitinclude/linux/find.h lib/find_bit.c+160 -44 replies
2/5cpumask: Implement cpumask_{first,next}_{not,}andnotinclude/linux/cpumask.h+60 -02 replies
3/5sched: NUMA-aware per-memory-map concurrency IDsinclude/linux/mm_types.h kernel/sched/core.c kernel/sched/sched.h+190 -160 replies
4/5selftests/rseq: x86: Implement rseq_load_u32_u32tools/testing/selftests/rseq/rseq-x86-bits.h tools/testing/selftests/rseq/rseq.h+57 -00 replies
5/5selftests/rseq: Implement NUMA node id vs mm_cid invariant testtools/testing/selftests/rseq/.gitignore tools/testing/selftests/rseq/Makefile tools/testing/selftests/rseq/basic_numa_test.c+146 -10 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchShuah Khan
SeriesR-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/5] sched: NUMA-aware concurrency IDs

The issue addressed by this series is the non-locality of NUMA accesses to data structures indexed by concurrency IDs: for example, in a scenario where a process has two threads, and they periodically run one after the other on different NUMA nodes, each will be assigned mm_cid=0. As a consequence, they will end up accessing the same pages, and thus at least one of the threads will need to perform remote NUMA accesses, which is inefficient.

Solve this by making the rseq concurrency ID (mm_cid) NUMA-aware. On NUMA systems, when a NUMA-aware concurrency ID is observed by user-space to be associated with a NUMA node, guarantee that it never changes NUMA node unless either a kernel-level NUMA configuration change happens, or scheduler migrations end up migrating tasks across NUMA nodes.

There is a tradeoff between NUMA locality and compactness of the concurrency ID allocation. Favor compactness over NUMA locality when the scheduler migrates tasks across NUMA nodes, as this does not cause the frequent remote NUMA accesses behavior. This is done by limiting the concurrency ID range to minimum between the number of threads belonging to the process and the number of allowed CPUs.

This series applies on top of v6.10.3.

Cc Valentin Schneider <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Dietmar Eggemann <[email protected]>
Cc Ben Segall <[email protected]>
Cc Yury Norov <[email protected]>
Cc Rasmus Villemoes <[email protected]>
Cc Shuah Khan <[email protected]>

Mathieu Desnoyers (5):
lib: Implement find_{first,next,nth}_notandnot_bit,
find_first_andnot_bit
cpumask: Implement cpumask_{first,next}_{not,}andnot
sched: NUMA-aware per-memory-map concurrency IDs selftests/rseq: x86: Implement rseq_load_u32_u32 selftests/rseq: Implement NUMA node id vs mm_cid invariant test

 include/linux/cpumask.h                       |  60 ++++++++
 include/linux/find.h                          | 122 ++++++++++++++-
 include/linux/mm_types.h                      |  57 ++++++-
 kernel/sched/core.c                           |  10 +-
 kernel/sched/sched.h                          | 139 +++++++++++++++--
 lib/find_bit.c                                |  42 +++++
 tools/testing/selftests/rseq/.gitignore       |   1 +
 tools/testing/selftests/rseq/Makefile         |   2 +-
 .../testing/selftests/rseq/basic_numa_test.c  | 144 ++++++++++++++++++
 tools/testing/selftests/rseq/rseq-x86-bits.h  |  43 ++++++
 tools/testing/selftests/rseq/rseq.h           |  14 ++
 11 files changed, 613 insertions(+), 21 deletions(-)
 create mode 100644 tools/testing/selftests/rseq/basic_numa_test.c
Signature · 1 line
2.39.2