public inbox for rcu@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: boqun.feng@gmail.com, mark.rutland@arm.com,
	mathieu.desnoyers@efficios.com, roman.gushchin@linux.dev
Subject: Handling large numbers of hazard pointers
Date: Sat, 13 Dec 2025 14:31:45 -0800	[thread overview]
Message-ID: <77ffb53f-91fb-4bd4-96d4-e16b0e6ff0f1@paulmck-laptop> (raw)

Hello!

I didn't do a good job of answering the "what about large numbers of
hazard pointers" at Boqun's and my hazard-pointers talk at Linux Plumbers
Conference yesterday, so please allow me to at least start on the path
towards fixing that problem.

Also, there were a couple of people participating whose email addresses
I don't know, so please feel free to CC them.

The trick is that in real workloads to date, although there might be
millions of hazard pointers, there will typically only be a few active
per CPU at a given time.  This of course suggests a per-CPU data structure
tracking the active ones.  Allocating a hazard pointer grabs an unused one
from this array, or, if all entries are in use, takes memory provided by
the caller and links it into an overflow list.  Either way, it returns a
pointer to the hazard pointer that is now visible to updaters.  When done,
the caller calls a function that marks the array-entry as unused or
removes the element from the list, as the case may be.  Because hazard
pointers can migrate among CPUs, full synchronization is required when
operating on the array and the overflow list.

And either way, the caller is responsible for allocating and freeing the
backup hazard-pointer structure that will be used in case of overflow.
And also either way, the updater need only deal with hazard pointers
that are currently in use.

Cue Mark telling me that his use case can have millions of active hazard
pointers?  ;-)

							Thanx, Paul

             reply	other threads:[~2025-12-13 22:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13 22:31 Paul E. McKenney [this message]
2025-12-14  2:38 ` Handling large numbers of hazard pointers Mathieu Desnoyers
2025-12-14  6:37   ` Joel Fernandes
2025-12-14  7:14     ` Joel Fernandes
2025-12-14 13:43       ` Mathieu Desnoyers
2025-12-14 20:49         ` Boqun Feng
2025-12-15 19:34           ` Mathieu Desnoyers
2025-12-15 21:11             ` Mathieu Desnoyers
2025-12-14 22:36         ` Joel Fernandes
2025-12-14 23:26           ` Joel Fernandes
2025-12-15 19:38             ` Mathieu Desnoyers
2025-12-17  7:54               ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77ffb53f-91fb-4bd4-96d4-e16b0e6ff0f1@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rcu@vger.kernel.org \
    --cc=roman.gushchin@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox