On 2026-10-11 15:59, Bradley Morgan wrote:
On 11 October 2026 20:48:50 BST, Mathieu Desnoyers
<[email protected]> wrote:
Introduce a "try acquire" hazard pointer fast path, which performs an
early load of the address to store it into the hazard pointer slot, and
then re-loads that address after a barrier to check whether it has
changed meanwhile.

On comparison failure, rather than re-try, guarantee forward progress by
falling back to the __hazptr_acquire slow path on failure.

The acquire slow path attempts a try-acquire for any available per-CPU
slot. If that fails, it chains the backup slot into the overflow list,
therefore guaranteeing forward progress for both hazard pointer
read-side and synchronize:

- Readers set the wildcard, and then proceed to set the more
  specific address to replace the wildcard.

- One synchronize alternates between two overflow list periods,
  scanning each one while readers are added to the other period,
  thus preventing a steady flow of readers from preventing
  synchronize forward progress.

With this change, the scan on per-CPU slots don't need to expect a
wildcard anymore, because none can be produced by readers. Wildcards are
only expected within overflow lists.

Signed-off-by: Mathieu Desnoyers <[email protected]>
Suggested-by: Gary Guo <[email protected]>
Link: https://lore.kernel.org/lkmm/[email protected]/
Reviewed-by: Gary Guo <[email protected]>

Hi, my R-B still stands from

https://lore.kernel.org/all/[email protected]/

Reviewed-by: Bradley Morgan <[email protected]>

Sorry, I forgot to add it to my commit message. I'll add it to the next
round (if there is one), else hopefully Paul can add the R-B tag if he
picks up this series.

Thanks!

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

Reply via email to