[RFC PATCH v2 0/4] sched+mm: Track lazy active mm existence with hazard pointers
From: Mathieu Desnoyers
Date: Fri Oct 04 2024 - 15:32:36 EST
[ Based on recent discussion with Linus, it appears that this series
just proves that it's time to get rid of active mm altogether:
https://lore.kernel.org/lkml/CAHk-=wgztWbA4z85xKob4eS9P=Nt5h4j=HnN+Pc90expskiCRA@xxxxxxxxxxxxxx/
I'm posting a v2 fixing minor issues from v1 in case it can be useful
to try hazard pointers with other use-cases, or for further
benchmarking of active mm tracking impact.
]
Hazard pointers appear to be a good fit for replacing refcount based lazy
active mm tracking.
Highlight:
will-it-scale context_switch1_threads
nr threads (-t) speedup
1 -0.2%
2 +0.4%
3 +0.2%
6 +0.6%
12 +0.8%
24 +3%
48 +12%
96 +21%
192 +28%
384 +4%
768 -0.6%
This series applies on top of v6.11.1.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Nicholas Piggin <npiggin@xxxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Cc: John Stultz <jstultz@xxxxxxxxxx>
Cc: Neeraj Upadhyay <Neeraj.Upadhyay@xxxxxxx>
Cc: Boqun Feng <boqun.feng@xxxxxxxxx>
Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
Cc: Joel Fernandes <joel@xxxxxxxxxxxxxxxxx>
Cc: Josh Triplett <josh@xxxxxxxxxxxxxxxx>
Cc: Uladzislau Rezki <urezki@xxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Lai Jiangshan <jiangshanlai@xxxxxxxxx>
Cc: Zqiang <qiang.zhang1211@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Waiman Long <longman@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>
Cc: maged.michael@xxxxxxxxx
Cc: Mateusz Guzik <mjguzik@xxxxxxxxx>
Cc: Jonas Oberhauser <jonas.oberhauser@xxxxxxxxxxxxxxx>
Cc: rcu@xxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
Cc: lkmm@xxxxxxxxxxxxxxx
Mathieu Desnoyers (4):
compiler.h: Introduce ptr_eq() to preserve address dependency
Documentation: RCU: Refer to ptr_eq()
hp: Implement Hazard Pointers
sched+mm: Use hazard pointers to track lazy active mm existence
Documentation/RCU/rcu_dereference.rst | 38 ++++++-
Documentation/mm/active_mm.rst | 9 +-
arch/Kconfig | 32 ------
arch/powerpc/Kconfig | 1 -
arch/powerpc/mm/book3s64/radix_tlb.c | 23 +---
include/linux/compiler.h | 63 ++++++++++
include/linux/hp.h | 158 ++++++++++++++++++++++++++
include/linux/mm_types.h | 3 -
include/linux/sched/mm.h | 71 +++++-------
kernel/Makefile | 2 +-
kernel/exit.c | 4 +-
kernel/fork.c | 47 ++------
kernel/hp.c | 46 ++++++++
kernel/sched/sched.h | 8 +-
lib/Kconfig.debug | 10 --
15 files changed, 350 insertions(+), 165 deletions(-)
create mode 100644 include/linux/hp.h
create mode 100644 kernel/hp.c
--
2.39.2