Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-28 Thread Alan Huang
2024年9月29日 06:10,Alan Huang wrote: > > 2024年9月28日 06:18,Jonas Oberhauser wrote: >> >> >> >> Am 9/27/2024 um 10:10 PM schrieb Mathieu Desnoyers: >>> On 2024-09-27 21:23, Jonas Oberhauser wrote: >>> [...] That idea seems to be confirmed by this (atrocious, not to be copied!) example:

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-28 Thread Alan Huang
2024年9月28日 06:18,Jonas Oberhauser wrote: > > > > Am 9/27/2024 um 10:10 PM schrieb Mathieu Desnoyers: >> On 2024-09-27 21:23, Jonas Oberhauser wrote: >> [...] >>> That idea seems to be confirmed by this (atrocious, not to be copied!) >>> example: >>> >>> int fct_escape_address_of_b(void) >>> {

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Jonas Oberhauser
Am 9/27/2024 um 10:10 PM schrieb Mathieu Desnoyers: On 2024-09-27 21:23, Jonas Oberhauser wrote: [...] That idea seems to be confirmed by this (atrocious, not to be copied!) example: int fct_escape_address_of_b(void) { int *a, *b; do { a = READ_ONCE(p); asm vola

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 21:23, Jonas Oberhauser wrote: [...] That idea seems to be confirmed by this (atrocious, not to be copied!) example: int fct_escape_address_of_b(void) {     int *a, *b;     do {     a = READ_ONCE(p);     asm volatile ("" : : : "memory");     b = READ_ONCE(p);   

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Linus Torvalds
On Fri, 27 Sept 2024 at 12:28, Linus Torvalds wrote: > > Dammit, people, read the code I posted. Actually, no, apologies. You were right, and I was wrong. It does need both of the sources of the comparison to be hidden, because while even hiding just one side makes the comparison result "meaning

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 20:13, Linus Torvalds wrote: On Fri, 27 Sept 2024 at 10:53, Mathieu Desnoyers wrote: (b) the value barrier needs to be on *both* values so that the order of the equality testing doesn't matter. If we use OPTIMIZER_HIDE_VAR() on both parameters, it indeed minimizes the odds

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Linus Torvalds
On Fri, 27 Sept 2024 at 12:12, Jonas Oberhauser wrote: > > I think it depends on which one you hide. No. Dammit, people, read the code I posted. > But for > > z = a; > hide(z); > if (z==b) { *b; } No. I *intentionally* made it an inline function, and only hid the arguments to the equali

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Jonas Oberhauser
Two comments inline, Am 9/27/2024 um 6:38 AM schrieb Boqun Feng: compilers can replace 'ptr' with 'head' because of the equality, and even putting barrier() here cannot prevent compiler to rewrite the else branch into: else { barrier(); return head;

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Jonas Oberhauser
Am 9/27/2024 um 8:13 PM schrieb Linus Torvalds: Because even hiding the value one from the compiler will mean that it can't use the comparison to decide that the originals are equal, even if one of them is unhidden. No? Linus I think it depends on which one you hide. If yo

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Linus Torvalds
On Fri, 27 Sept 2024 at 10:53, Mathieu Desnoyers wrote: > > > (b) the value barrier needs to be on *both* values so that the order > > of the equality testing doesn't matter. > > If we use OPTIMIZER_HIDE_VAR() on both parameters, it indeed minimizes > the odds that someone get the order wrong, b

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 19:23, Linus Torvalds wrote: On Fri, 27 Sept 2024 at 10:17, Mathieu Desnoyers wrote: The barrier() is ineffective at fixing the issue. It does not prevent the compiler CSE from losing the address dependency: Ok. Thanks for actually specifying code. That needs to be (a) in a

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Linus Torvalds
On Fri, 27 Sept 2024 at 10:17, Mathieu Desnoyers wrote: > > The barrier() is ineffective at fixing the issue. > It does not prevent the compiler CSE from losing the > address dependency: Ok. Thanks for actually specifying code. That needs to be (a) in a comment (b) the value barrier needs to

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 18:44, Linus Torvalds wrote: On Thu, 26 Sept 2024 at 18:38, Boqun Feng wrote: Note that ADDRESS_EQ() only hide first parameter, so this should be ADDRESS_EQ(b, a). Yeah, please stop making things unnecessarily complicated. Just use a barrier(). Please. Stop these stupid games

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Linus Torvalds
On Thu, 26 Sept 2024 at 18:38, Boqun Feng wrote: > > Note that ADDRESS_EQ() only hide first parameter, so this should be > ADDRESS_EQ(b, a). Yeah, please stop making things unnecessarily complicated. Just use a barrier(). Please. Stop these stupid games until you can show why it matters. And b

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Alan Huang
2024年9月27日 12:28,Boqun Feng wrote: > > On Fri, Sep 27, 2024 at 09:37:50AM +0800, Boqun Feng wrote: >> >> >> On Fri, Sep 27, 2024, at 9:30 AM, Mathieu Desnoyers wrote: >>> On 2024-09-27 02:01, Boqun Feng wrote: #define ADDRESS_EQ(var, expr) \ ({ \ bool _cmp_res = (unsigned lon

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 16:43, Mathieu Desnoyers wrote: On 2024-09-27 12:59, Mathieu Desnoyers wrote: On 2024-09-27 06:28, Boqun Feng wrote: [...] I replaced ADDRESS_EQ(a, b) with ADDRESS_EQ(b, a), and the compile result shows it can prevent the issue: I see, yes. It prevents the issue by making the c

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 12:59, Mathieu Desnoyers wrote: On 2024-09-27 06:28, Boqun Feng wrote: [...] I replaced ADDRESS_EQ(a, b) with ADDRESS_EQ(b, a), and the compile result shows it can prevent the issue: I see, yes. It prevents the issue by making the compiler create a copy of the value "modified" b

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-27 Thread Mathieu Desnoyers
On 2024-09-27 06:28, Boqun Feng wrote: On Fri, Sep 27, 2024 at 09:37:50AM +0800, Boqun Feng wrote: On Fri, Sep 27, 2024, at 9:30 AM, Mathieu Desnoyers wrote: On 2024-09-27 02:01, Boqun Feng wrote: #define ADDRESS_EQ(var, expr) \

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Boqun Feng
On Fri, Sep 27, 2024 at 03:20:40AM +0200, Mathieu Desnoyers wrote: > On 2024-09-26 18:12, Linus Torvalds wrote: > > On Thu, 26 Sept 2024 at 08:54, Jonas Oberhauser > > wrote: > > > > > > No, the issue introduced by the compiler optimization (or by your > > > original patch) is that the CPU can sp

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Boqun Feng
On Fri, Sep 27, 2024 at 09:37:50AM +0800, Boqun Feng wrote: > > > On Fri, Sep 27, 2024, at 9:30 AM, Mathieu Desnoyers wrote: > > On 2024-09-27 02:01, Boqun Feng wrote: > >>#define ADDRESS_EQ(var, expr) > >> \ > >>({

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Mathieu Desnoyers
On 2024-09-27 02:01, Boqun Feng wrote: #define ADDRESS_EQ(var, expr) \ ({ \ bool _cmp_res = (unsigned long)(var) == (unsigned long)

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Boqun Feng
On Fri, Sep 27, 2024, at 9:30 AM, Mathieu Desnoyers wrote: > On 2024-09-27 02:01, Boqun Feng wrote: >> #define ADDRESS_EQ(var, expr) >> \ >> ({ >> \ >>

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Mathieu Desnoyers
On 2024-09-26 18:12, Linus Torvalds wrote: On Thu, 26 Sept 2024 at 08:54, Jonas Oberhauser wrote: No, the issue introduced by the compiler optimization (or by your original patch) is that the CPU can speculatively load from the first pointer as soon as it has completed the load of that pointer

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Boqun Feng
On Thu, Sep 26, 2024 at 09:54:33AM -0700, Linus Torvalds wrote: > On Thu, 26 Sept 2024 at 09:40, Jonas Oberhauser > wrote: > > > > Boqun seems to be unhappy with a barrier though, because it would > > theoretically also forbid unrelated optimizations. > > Well, doing a "barrier()" is kind of a bi

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Linus Torvalds
On Thu, 26 Sept 2024 at 08:54, Jonas Oberhauser wrote: > > No, the issue introduced by the compiler optimization (or by your > original patch) is that the CPU can speculatively load from the first > pointer as soon as it has completed the load of that pointer: You mean the compiler can do it. The

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Linus Torvalds
On Thu, 26 Sept 2024 at 09:40, Jonas Oberhauser wrote: > > Boqun seems to be unhappy with a barrier though, because it would > theoretically also forbid unrelated optimizations. Well, doing a "barrier()" is kind of a big hammer thing, but honestly, I don't think we've ever seen any real situation

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Jonas Oberhauser
Am 9/26/2024 um 6:12 PM schrieb Linus Torvalds: On Thu, 26 Sept 2024 at 08:54, Jonas Oberhauser wrote: No, the issue introduced by the compiler optimization (or by your original patch) is that the CPU can speculatively load from the first pointer as soon as it has completed the load of that

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-26 Thread Jonas Oberhauser
Am 9/26/2024 um 8:16 AM schrieb Mathieu Desnoyers: On 2024-09-25 15:20, Mathieu Desnoyers wrote: [...] static inline bool same_ptr(void *a, void *b) { asm goto ( "cmpq %[a], %[b]\n\t" "jne %l[ne]\n\t" : : [a] "r" (a), [b] "r" (b) : : ne); return t

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Mathieu Desnoyers
On 2024-09-25 15:20, Mathieu Desnoyers wrote: [...] static inline bool same_ptr(void *a, void *b) {     asm goto (     "cmpq %[a], %[b]\n\t"     "jne %l[ne]\n\t"     : : [a] "r" (a), [b] "r" (b)     : : ne);     return true; ne:     return false; } Based on the informatio

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Mathieu Desnoyers
On 2024-09-25 15:10, Mathieu Desnoyers wrote: [...] Cleaner without goto in the user code: #include #include static inline bool same_ptr(void *a, void *b) { asm goto ( "cmpq %[a], %[b]\n\t" "jne %l[ne]\n\t" : : [a] "r" (a), [b] "r" (b) : : ne); return t

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Mathieu Desnoyers
On 2024-09-25 14:47, Mathieu Desnoyers wrote: [...] Like so: #include #define __str_1(x)  #x #define __str(x)    __str_1(x) /* x86-64 */ #define bne_ptr(_a, _b, _label) \     asm goto ( \     "cmpq %[a], %[b]\n\t" \     "jne %l[" __str(_label) "]\n\t" \     : : [a] "r" (_a),

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Jonas Oberhauser
Am 9/25/2024 um 1:59 PM schrieb Mathieu Desnoyers: On 2024-09-25 12:45, Boqun Feng wrote: On Wed, Sep 25, 2024 at 12:11:52PM +0200, Jonas Oberhauser wrote: Am 9/25/2024 um 12:02 PM schrieb Boqun Feng: Hi Jonas, Of course, if we are really worried about compilers being too "smart" Ah, I

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Mathieu Desnoyers
On 2024-09-25 14:16, Boqun Feng wrote: On Wed, Sep 25, 2024 at 01:59:06PM +0200, Mathieu Desnoyers wrote: On 2024-09-25 12:45, Boqun Feng wrote: On Wed, Sep 25, 2024 at 12:11:52PM +0200, Jonas Oberhauser wrote: Am 9/25/2024 um 12:02 PM schrieb Boqun Feng: Hi Jonas, Of course, if we are rea

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Boqun Feng
On Wed, Sep 25, 2024 at 01:59:06PM +0200, Mathieu Desnoyers wrote: > On 2024-09-25 12:45, Boqun Feng wrote: > > On Wed, Sep 25, 2024 at 12:11:52PM +0200, Jonas Oberhauser wrote: > > > > > > > > > Am 9/25/2024 um 12:02 PM schrieb Boqun Feng: > > > > Hi Jonas, > > > > > > > > Of > > > > course, if

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Mathieu Desnoyers
On 2024-09-25 12:45, Boqun Feng wrote: On Wed, Sep 25, 2024 at 12:11:52PM +0200, Jonas Oberhauser wrote: Am 9/25/2024 um 12:02 PM schrieb Boqun Feng: Hi Jonas, Of course, if we are really worried about compilers being too "smart" Ah, I see you know me better and better... we can always d

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Boqun Feng
On Wed, Sep 25, 2024 at 12:11:52PM +0200, Jonas Oberhauser wrote: > > > Am 9/25/2024 um 12:02 PM schrieb Boqun Feng: > > Hi Jonas, > > > > Of > > course, if we are really worried about compilers being too "smart" > > Ah, I see you know me better and better... > > > we can always do the compari

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Jonas Oberhauser
Am 9/25/2024 um 12:02 PM schrieb Boqun Feng: Hi Jonas, Of course, if we are really worried about compilers being too "smart" Ah, I see you know me better and better... we can always do the comparison in asm code, then compilers don't know anything of the equality between 'ptr' and 'head -

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-25 Thread Boqun Feng
Hi Jonas, On Fri, Sep 20, 2024 at 09:41:15AM +0200, Jonas Oberhauser wrote: > > > Am 9/17/2024 um 4:33 PM schrieb Boqun Feng: > > +static inline void *__hazptr_tryprotect(hazptr_t *hzp, > > + void *const *p, > > + unsigned long

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-20 Thread Jonas Oberhauser
Am 9/19/2024 um 10:30 PM schrieb Jonas Oberhauser: Am 9/19/2024 um 2:12 AM schrieb Jann Horn: On Tue, Sep 17, 2024 at 4:33 PM Boqun Feng wrote: Hazard pointers [1] provide a way to dynamically distribute refcounting and can be used to improve the scalability of refcounting without signif

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-20 Thread Jonas Oberhauser
Am 9/17/2024 um 4:33 PM schrieb Boqun Feng: +static inline void *__hazptr_tryprotect(hazptr_t *hzp, + void *const *p, + unsigned long head_offset) +{ + void *ptr; + struct callback_head *head; + + ptr

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Jonas Oberhauser
Am 9/19/2024 um 2:12 AM schrieb Jann Horn: On Tue, Sep 17, 2024 at 4:33 PM Boqun Feng wrote: Hazard pointers [1] provide a way to dynamically distribute refcounting and can be used to improve the scalability of refcounting without significant space cost. +static inline void *__hazptr_try

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Alan Huang
2024年9月20日 02:58,Boqun Feng wrote: > > On Thu, Sep 19, 2024 at 09:57:12PM +0800, Alan Huang wrote: > [...] >>> >>> I think you're right. (Although the node will be eventually deleted at >>> cleanup_hazptr_context(), however there could be a long-live >>> hazptr_context). It should be: >>> >>> h

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Boqun Feng
On Thu, Sep 19, 2024 at 09:57:12PM +0800, Alan Huang wrote: [...] > > > > I think you're right. (Although the node will be eventually deleted at > > cleanup_hazptr_context(), however there could be a long-live > > hazptr_context). It should be: > > > > hazptr_t val = smp_load_acquire(&hzcp->slots

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Jonas Oberhauser
Am 9/19/2024 um 8:56 AM schrieb Boqun Feng: On Wed, Sep 18, 2024 at 11:17:37PM +0800, Alan Huang wrote: [...] +#define hazptr_tryprotect(hzp, gp, field) (typeof(gp))__hazptr_tryprotect(hzp, (void **)&(gp), offsetof(typeof(*gp), field)) +#define hazptr_protect(hzp, gp, field) ({ \ + typeof(gp

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Alan Huang
2024年9月19日 15:10,Boqun Feng wrote: > > On Thu, Sep 19, 2024 at 02:39:13PM +0800, Lai Jiangshan wrote: >> On Tue, Sep 17, 2024 at 10:34 PM Boqun Feng wrote: >> >>> +static void hazptr_context_snap_readers_locked(struct hazptr_reader_tree >>> *tree, >>> +

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Jonas Oberhauser
Am 9/17/2024 um 4:33 PM schrieb Boqun Feng: +#define hazptr_protect(hzp, gp, field) ({ \ + typeof(gp) ___p;\ + \ + ___p = hazptr_trypro

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Alan Huang
2024年9月19日 15:10,Boqun Feng wrote: > > On Thu, Sep 19, 2024 at 02:39:13PM +0800, Lai Jiangshan wrote: >> On Tue, Sep 17, 2024 at 10:34 PM Boqun Feng wrote: >> >>> +static void hazptr_context_snap_readers_locked(struct hazptr_reader_tree >>> *tree, >>> +

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Alan Huang
2024年9月19日 15:10,Boqun Feng wrote: > > On Thu, Sep 19, 2024 at 02:39:13PM +0800, Lai Jiangshan wrote: >> On Tue, Sep 17, 2024 at 10:34 PM Boqun Feng wrote: >> >>> +static void hazptr_context_snap_readers_locked(struct hazptr_reader_tree >>> *tree, >>> +

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Lai Jiangshan
On Tue, Sep 17, 2024 at 10:34 PM Boqun Feng wrote: > +static void hazptr_context_snap_readers_locked(struct hazptr_reader_tree > *tree, > + struct hazptr_context *hzcp) > +{ > + lockdep_assert_held(hzcp->lock); > + > + for (int i = 0; i <

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Boqun Feng
On Wed, Sep 18, 2024 at 11:17:37PM +0800, Alan Huang wrote: [...] > > +#define hazptr_tryprotect(hzp, gp, field) > > (typeof(gp))__hazptr_tryprotect(hzp, (void **)&(gp), offsetof(typeof(*gp), > > field)) > > +#define hazptr_protect(hzp, gp, field) ({ \ > > + typeof(gp) ___p; \ > > + \ > > + ___p

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-19 Thread Boqun Feng
On Thu, Sep 19, 2024 at 02:39:13PM +0800, Lai Jiangshan wrote: > On Tue, Sep 17, 2024 at 10:34 PM Boqun Feng wrote: > > > +static void hazptr_context_snap_readers_locked(struct hazptr_reader_tree > > *tree, > > + struct hazptr_context *hzcp) > > +{ >

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-18 Thread Jann Horn
On Tue, Sep 17, 2024 at 4:33 PM Boqun Feng wrote: > Hazard pointers [1] provide a way to dynamically distribute refcounting > and can be used to improve the scalability of refcounting without > significant space cost. > +static inline void *__hazptr_tryprotect(hazptr_t *hzp, > +

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-18 Thread Alan Huang
2024年9月17日 22:33,Boqun Feng wrote: > > Hazard pointers [1] provide a way to dynamically distribute refcounting > and can be used to improve the scalability of refcounting without > significant space cost. > > Hazard pointers are similar to RCU: they build the synchronization > between two part,

Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-18 Thread Mathieu Desnoyers
On 2024-09-17 16:33, Boqun Feng wrote: [...] The synchronization between readers and updaters is built around "hazard pointer slots": a slot readers can use to store a pointer value. Reader side protection: 1. Read the value of a pointer to the target data element. 2. Store it to a h

[RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

2024-09-17 Thread Boqun Feng
Hazard pointers [1] provide a way to dynamically distribute refcounting and can be used to improve the scalability of refcounting without significant space cost. Hazard pointers are similar to RCU: they build the synchronization between two part, readers and updaters. Readers are refcount users, t