From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: paulmck@kernel.org
Cc: Boqun Feng <boqun.feng@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v5 1/2] hazptr: Implement Hazard Pointers
Date: Fri, 26 Jun 2026 23:56:13 -0400 [thread overview]
Message-ID: <0d9f61c1-4a93-4f5a-a703-12ef4f325aa9@efficios.com> (raw)
In-Reply-To: <f63560c3-e1bc-4c66-a72d-307ff386fe77@paulmck-laptop>
On 2026-06-26 19:06, Paul E. McKenney wrote:
> [ Trimming CC. ]
>
> On Mon, Feb 23, 2026 at 03:44:17PM -0500, Mathieu Desnoyers wrote:
>> This API provides existence guarantees of objects through Hazard
>> Pointers [1] (hazptr).
>>
>> Its main benefit over RCU is that it allows fast reclaim of
>> HP-protected pointers without needing to wait for a grace period.
>>
>> This implementation has 4 statically allocated hazard pointer slots per
>> cpu for the fast path, and relies on a on-stack backup slot allocated by
>> the hazard pointer user as fallback in case no per-cpu slot is
>> available.
>>
>> It integrates with the scheduler to migrate per-CPU slots to the backup
>> slot on context switch. This ensures that the per-CPU slots won't be
>> used by blocked or preempted tasks holding on hazard pointers for a long
>> time.
>>
>> References:
>>
>> [1]: M. M. Michael, "Hazard pointers: safe memory reclamation for
>> lock-free objects," in IEEE Transactions on Parallel and
>> Distributed Systems, vol. 15, no. 6, pp. 491-504, June 2004
>
> I (finally) put together a stress test for this, which is the following
> commits on -rcu:
>
> bfb239e036d616 torture: Add a hazptrtorture.c torture test
> adda38c3cffcd6 hazptrtorture: Add testing of on-stack hazptr_ctx structures
> 311e199e482873 hazptrtorture: Add microsecond-scale sleep in readers
> 21ccb41f79a45b hazptrtorture: Enable system-independent CPU overcommit
> 82e8c141265c81 torture: Add a stutter_will_wait() function
> 9ad8169bd3a367 hazptrtorture: Use mnemonic local variables for context information
> cd541d5eb7347f hazptrtorture: Split hazptr_torture_reader_tail() from hazptr_torture_reader()
> 0de8bda6b00051 hazptrtorture: Add kthread to release deferred hazard pointers
> 3deefef00acb22 hazptrtorture: Defer release of hazard pointers
> 65b2cf3c6ea34e hazptrtorture: Add irq_acquire to acquire hazptr from irq
> 98d334c04b58fe hazptrtorture: Use task_state_to_char() for task-state reporting
> 1e89aae50a3fde hazptrtorture: Pass hazptr_pending to hazptr_torture_reader_tail()
> 4b1a177190e2e1 hazptrtorture: Add the ability to disable the writer kthread
> 2c966f58358329 hazptrtorture: Add irq_release to release hazptr from irq
> 16258269b41ed3 hazptrtorture: Accumulate operation statistics
> c090e2659abcb3 doc: Add hazptrtorture module parameters
>
> Initial runs suggest that hazard pointers cannot be acquired by one
> task and released by another. Is that expected behavior, or is my test
> improperly passing the hazard pointers? If the latter, we should of
> course document the proper hazard-pointer-passing mechanism.
This is unexpected. I've looked at your test code quickly and could
not figure out what's wrong though. But it's late. How do you observe
that it fails ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2026-06-27 3:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 20:44 [RFC PATCH v5 0/2] " Mathieu Desnoyers
2026-02-23 20:44 ` [RFC PATCH v5 1/2] hazptr: Implement " Mathieu Desnoyers
2026-06-26 23:06 ` Paul E. McKenney
2026-06-27 3:56 ` Mathieu Desnoyers [this message]
2026-06-27 4:14 ` Paul E. McKenney
2026-06-27 12:56 ` Mathieu Desnoyers
2026-06-27 15:21 ` Mathieu Desnoyers
2026-06-27 17:36 ` Paul E. McKenney
2026-07-07 19:40 ` Mathieu Desnoyers
2026-07-07 21:42 ` Paul E. McKenney
2026-07-08 22:55 ` Paul E. McKenney
2026-07-09 2:45 ` Mathieu Desnoyers
2026-07-09 3:28 ` Paul E. McKenney
2026-07-09 16:02 ` Paul E. McKenney
2026-07-09 16:03 ` Mathieu Desnoyers
2026-07-09 16:06 ` Paul E. McKenney
2026-02-23 20:44 ` [RFC PATCH v5 2/2] hazptr: Add refscale test Mathieu Desnoyers
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=0d9f61c1-4a93-4f5a-a703-12ef4f325aa9@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
/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
all inboxes | Powered by JetHome®