The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] sched: Run task_mm_cid_work in batches to lower latency
@ 2025-02-17 11:23 Gabriele Monaco
  2025-02-17 11:23 ` [PATCH 1/2] sched: Compact RSEQ concurrency IDs in batches Gabriele Monaco
  2025-02-17 11:23 ` [PATCH 2/2] rseq/selftests: Add test for mm_cid compaction Gabriele Monaco
  0 siblings, 2 replies; 8+ messages in thread
From: Gabriele Monaco @ 2025-02-17 11:23 UTC (permalink / raw)
  To: linux-kernel, Mathieu Desnoyers, Peter Zijlstra, Ingo Molnar,
	Paul E. McKenney
  Cc: Gabriele Monaco, Shuah Khan

This patchset is a continuation of [1] but using a simpler approach.
The task_mm_cid_work runs as a task_work returning to userspace and
causes a non-negligible scheduling latency, mostly due to its iterations
over all cores.

Split the work into several batches, each call to task_mm_cid_work will
not run for all cpus but just for a configurable number of cpus. Next
runs will pick up where the previous left off.
The mechanism that avoids running too frequently (100ms) is enforced
only when we finish all cpus, that is when we start from 0.

Patch 1 implements the logic behind the change

Patch 2 implements a test to validate mm_cids are compacted, since this
patchset doesn't address the fact processes running in bursts are less
likely to run the task_work, we add a busy loop in the test to make sure
the mm_cid runs during the test duration (not necessary in [1]). The
test would of course fail if the mm_cid compaction mechanism is broken.

This patchset is based on 1/3 of [1] ("sched: Compact RSEQ concurrency
IDs with reduced threads and affinity"), which will be merged separately,
lacking that commit might have the test in patch 2 fail.

[1] - https://lore.kernel.org/lkml/20250210153253.460471-1-gmonaco@redhat.com/

To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
To: Paul E. McKenney <paulmck@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>

Gabriele Monaco (2):
  sched: Compact RSEQ concurrency IDs in batches
  rseq/selftests: Add test for mm_cid compaction

 include/linux/mm_types.h                      |   8 +
 init/Kconfig                                  |  12 +
 kernel/sched/core.c                           |  27 ++-
 tools/testing/selftests/rseq/.gitignore       |   1 +
 tools/testing/selftests/rseq/Makefile         |   2 +-
 .../selftests/rseq/mm_cid_compaction_test.c   | 208 ++++++++++++++++++
 6 files changed, 254 insertions(+), 4 deletions(-)
 create mode 100644 tools/testing/selftests/rseq/mm_cid_compaction_test.c

-- 
2.48.1


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

end of thread, other threads:[~2025-02-18 13:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 11:23 [PATCH 0/2] sched: Run task_mm_cid_work in batches to lower latency Gabriele Monaco
2025-02-17 11:23 ` [PATCH 1/2] sched: Compact RSEQ concurrency IDs in batches Gabriele Monaco
2025-02-17 19:46   ` Mathieu Desnoyers
2025-02-18  9:52     ` Gabriele Monaco
2025-02-17 11:23 ` [PATCH 2/2] rseq/selftests: Add test for mm_cid compaction Gabriele Monaco
2025-02-17 19:59   ` Mathieu Desnoyers
2025-02-18  8:13     ` Gabriele Monaco
2025-02-18 13:49       ` Gabriele Monaco

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