Skip to content

RFC Hazard Pointers

Mathieu Desnoyers linux-mm lkml lkmm rcu 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 RFC Latest2 patches 14 repliesIn review
  2. v4 RFC4 patches 30 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2hazptr: Implement Hazard Pointersinclude/linux/hazptr.h init/main.c kernel/Makefile +2 more+444 -114 replies
2/2hazptr: Add refscale testkernel/rcu/refscale.c+43 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [RFC PATCH v5 0/2] Hazard Pointers

Here is a v5 of my Hazard Pointers series. I know Boqun has a use case for it for lockdep.

This new version has those significant changes since v4:

- Fold scheduler integration.
- Actually set ctx slot to backup slot on context switch.
- Remove CONFIG_PREEMPT_HAZPTR config option.
- Use per-cpu ctx pointers for context switch slot tracking rather than per-task lists. This accelerates the hazptr acquire/release fast-path.
- Guarantee scan forward progress with two-lists scheme.
- Reimplement the hazptr acquire with a temporary wildcard to eliminate a dependency on the addr_p load, likely to cause a pipeline stall due to the needed memory barrier. This simplifies the algorithm, removes the need for pointer re-load + comparison, and is expected to be faster on some architectures.
- Reduce number of percpu slots to 4, introduce a hazptr_slot_item struct to contain both the slot and ctx pointers. Reducing number of slots to 4 makes sure all the slot and ctx pointers fit in a single cache line.
- Rebased on v7.0-rc1.

Feedback is welcome,

Thanks,

Mathieu

Cc Nicholas Piggin <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc Will Deacon <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Alan Stern <[email protected]>
Cc John Stultz <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Joel Fernandes <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Uladzislau Rezki <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Lai Jiangshan <[email protected]>
Cc Zqiang <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Waiman Long <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mateusz Guzik <[email protected]>
Cc Jonas Oberhauser <[email protected]>

Mathieu Desnoyers (2):
hazptr: Implement Hazard Pointers
hazptr: Add refscale test

 include/linux/hazptr.h | 197 +++++++++++++++++++++++++++++++++
 init/main.c            |   2 +
 kernel/Makefile        |   2 +-
 kernel/hazptr.c        | 242 +++++++++++++++++++++++++++++++++++++++++
 kernel/rcu/refscale.c  |  43 ++++++++
 kernel/sched/core.c    |   2 +
 6 files changed, 487 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/hazptr.h
 create mode 100644 kernel/hazptr.c
Signature · 1 line
2.39.5