public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sched/membarrier: Use per-CPU mutexes for targeted commands
@ 2026-04-09 21:22 Aniket Gattani
  2026-04-09 21:22 ` [PATCH 1/2] " Aniket Gattani
  2026-04-09 21:22 ` [PATCH 2/2] selftests/membarrier: Add rseq stress test for CFS throttle interactions Aniket Gattani
  0 siblings, 2 replies; 8+ messages in thread
From: Aniket Gattani @ 2026-04-09 21:22 UTC (permalink / raw)
  To: Mathieu Desnoyers, Paul E . McKenney
  Cc: Peter Zijlstra, Ingo Molnar, Ben Segall, Josh Don, linux-kernel,
	linux-kselftest, Aniket Gattani

This series mitigates a severe contention issue in the membarrier system
call by replacing the global membarrier_ipi_mutex with per-CPU mutexes
for targeted expedited commands.

Problem:
Currently, MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ relies on a single
global mutex to serialize IPIs. On large systems with heavy concurrent
usage, this creates significant contention. The issue cascades into
hard lockups when combined with CFS bandwidth throttling, during which
target CPUs may have interrupts disabled for extended periods.
If membarrier is waiting on such a CPU, it holds the global mutex,
stalling all other membarrier callers system-wide.

Solution:
Patch 1 introduces membarrier_cpu_mutexes to serialize expedited commands
specifically when a target CPU is provided, isolating the lock contention
to the targeted CPU. Broadcast commands continue to use the global mutex.

Patch 2 introduces a dedicated kselftest reproducer
(membarrier_rseq_stress) to permanently test this interaction. It
aggressively hammers targeted membarrier commands within a deep,
aggressively throttled cgroup hierarchy to prove the lockup scenario
and validate the fix.

Results:
As measured by the stress test introduced in Patch 2, testing on an
AMD Turin machine with 384 CPUs (2 NUMA nodes, SMT=2) shows:

Throughput: ~200x increase in successful membarrier calls.

Aniket Gattani (2):
  sched/membarrier: Use per-CPU mutexes for targeted commands
  selftests/membarrier: Add rseq stress test for CFS throttle
    interactions

 kernel/sched/membarrier.c                     |  48 +-
 tools/testing/selftests/membarrier/Makefile   |   5 +-
 .../membarrier/membarrier_rseq_stress.c       | 952 ++++++++++++++++++
 3 files changed, 989 insertions(+), 16 deletions(-)
 create mode 100644
 tools/testing/selftests/membarrier/membarrier_rseq_stress.c

-- 
2.54.0.rc0.605.g598a273b03-goog


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

end of thread, other threads:[~2026-04-28 12:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 21:22 [PATCH 0/2] sched/membarrier: Use per-CPU mutexes for targeted commands Aniket Gattani
2026-04-09 21:22 ` [PATCH 1/2] " Aniket Gattani
2026-04-10 12:48   ` Mathieu Desnoyers
2026-04-10 23:44     ` Aniket Gattani
2026-04-10 12:56   ` Peter Zijlstra
2026-04-10 23:55     ` Aniket Gattani
2026-04-28 12:35       ` Peter Zijlstra
2026-04-09 21:22 ` [PATCH 2/2] selftests/membarrier: Add rseq stress test for CFS throttle interactions Aniket Gattani

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