🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #1097

Re: Consequential RCU Performance

#1097
From: Chris M. Thomasson
Date: Wed, 02 Dec 2026 22:07
72 lines
3774 bytes
On 12/2/2026 2:00 PM, Chris M. Thomasson wrote:
> On 12/2/2026 11:48 AM, Joseph Seigh wrote:
>> On 11/30/26 11:55 AM, jseigh wrote:
>>> On 11/27/26 12:31, Joseph Seigh wrote:
>>>> I ran some performance measurements on the reader side, no write
>>>> updates, for a plain linked list traversal, 2 slightly different
>>>> consequential rcu traversals, and traversals using hazard
>>>> pointers w/o and w/ a store/load memory barrier.
>>>>
>>>> Timings are per node access.  Depth is the size of the list.
>>>>
>>> Updated hazard pointer traversal to use 2 hazard pointers.
>>> Add a wait-free hazard pointer (w/o mb) which only
>>> uses 1 hazard pointer.
>>>
> 
>>> cseq2: [...]
>>
>> I think what is happening is with a longer
>> list, the inner loop dominates and there
>> is some performance degradation from short
>> loops.
> __________
> base: elapsed =    2102889 (   4441250)
> avg =  1.05144 nsecs ( 2.22063 cycles)
> cseq1: elapsed =    2128434 (   4495216)
> avg =  1.06422 nsecs ( 2.24761 cycles)
> cseq2: elapsed =    2144710 (   4529588)
> avg =  1.07235 nsecs ( 2.26479 cycles)
> hzptr: elapsed =    2430719 (   5133628)
> avg =  1.21536 nsecs ( 2.56681 cycles)
> hzptr_mb: elapsed =   14681514 (  31006950)
> avg =  7.34076 nsecs (15.50347 cycles)
> hzptr wf: elapsed =    1991515 (   4206044)
> avg =  0.99576 nsecs ( 2.10302 cycles)
> __________
> 
> Almost has to be. Also, the cseq might have to reiterate the whole list 
> again if a counter is invalid wrt your:
> 
> 
> 
> using csequence_t = uint64_t;
> 
> inline bool cseq_retry(csequence_t mark, std::atomic<csequence_t> & 
> sequence)
> {
>      std::atomic_thread_fence(std::memory_order_acquire);
>      return mark != sequence.load(std::memory_order_acquire);
> }
> 
> csequence_t mark;
> 
> retry:
> do {
> 
>      mark = cseq_count.load(std::memory_order_acquire);
>      node_t * item = list.load(std::memory_order_acquire);
> 
>      for (int ndx2 = 0; ndx2 < depth; ndx2++) {
>          item = item->next.load(std::memory_order_acquire);
>          if (cseq_retry(mark, cseq_count)) [[unlikely]]
>              goto retry;
>      }
> 
> } while (cseq_retry(mark, cseq_count));
> 
> 
> Oh my!

If the user logic does any processing on nodes, and has to retry, well, 
humm...
Technical Details
Message-ID: <11eq4rj$3jdjs$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11eceq2$1rdof$1@dont-email.me> <11ek9pk$kb5m$1@dont-email.me> <11epsn1$3f2t3$1@dont-email.me> <11eq4e7$3j4jn$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.lang.c++
Subject: Re: Consequential RCU Performance
Date: Wed, 2 Dec 2026 14:07:47 -0800
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <11eq4rj$3jdjs$1@dont-email.me>
References: <11eceq2$1rdof$1@dont-email.me> <11ek9pk$kb5m$1@dont-email.me>
 <11epsn1$3f2t3$1@dont-email.me> <11eq4e7$3j4jn$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 02 Dec 2026 22:07:48 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3782268"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+grOo4W1Z2Ya9xt+upCPiUJvGe8Sk/oKE="; posting-host="893826ed375ffe79bd897ea0a9456029"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uZqTRC+1wqdXOMLiS+mJvyofMNo= sha256:Y7sGmKxZ/C5dDg4T2dqn4ZkZ2SQqskWtn6sEYFZ4QrU=
	sha1:4iYVv2xwOzu1CzYp0Y6pVTIQm3U= sha256:Hoow2PMXZLLelU0Hu1udEiFmksQDu8ppW/hxzLwTeDg=
Content-Language: en-US
In-Reply-To: <11eq4e7$3j4jn$1@dont-email.me>