[RFC PATCH v3 0/4] sched+mm: Track lazy active mm existence with hazard pointers

Mathieu Desnoyers posted 4 patches 1 month, 2 weeks ago
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/hazptr.h                | 165 ++++++++++++++++++++++++++
include/linux/mm_types.h              |   3 -
include/linux/sched/mm.h              |  68 ++++-------
kernel/Makefile                       |   2 +-
kernel/exit.c                         |   4 +-
kernel/fork.c                         |  47 ++------
kernel/hazptr.c                       |  51 ++++++++
kernel/sched/sched.h                  |   8 +-
lib/Kconfig.debug                     |  10 --
15 files changed, 358 insertions(+), 166 deletions(-)
create mode 100644 include/linux/hazptr.h
create mode 100644 kernel/hazptr.c
[RFC PATCH v3 0/4] sched+mm: Track lazy active mm existence with hazard pointers
Posted by Mathieu Desnoyers 1 month, 2 weeks ago
[
  I'm posting a v3 taking care of feedback from Peter Zijlstra and Paul
  E. McKenney 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@efficios.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: John Stultz <jstultz@google.com>
Cc: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Zqiang <qiang.zhang1211@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: maged.michael@gmail.com
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>
Cc: rcu@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: lkmm@lists.linux.dev

Mathieu Desnoyers (4):
  compiler.h: Introduce ptr_eq() to preserve address dependency
  Documentation: RCU: Refer to ptr_eq()
  hazptr: 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/hazptr.h                | 165 ++++++++++++++++++++++++++
 include/linux/mm_types.h              |   3 -
 include/linux/sched/mm.h              |  68 ++++-------
 kernel/Makefile                       |   2 +-
 kernel/exit.c                         |   4 +-
 kernel/fork.c                         |  47 ++------
 kernel/hazptr.c                       |  51 ++++++++
 kernel/sched/sched.h                  |   8 +-
 lib/Kconfig.debug                     |  10 --
 15 files changed, 358 insertions(+), 166 deletions(-)
 create mode 100644 include/linux/hazptr.h
 create mode 100644 kernel/hazptr.c

-- 
2.39.2