🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Consequential RCU

#518
From: Chris M. Thomasson
Date: Tue, 13 Oct 2026 19:36
73 lines
4274 bytes
On 10/13/2026 10:01 AM, Joseph Seigh wrote:
> On 10/11/26 11:11 AM, Joseph Seigh wrote:
>> On 9/16/26 6:25 PM, Joseph Seigh wrote:
>>> https://jseigh.wordpress.com/2026/09/07/consequential-concurrent- 
>>> sequential-rcu/
>>>
>>> The name doesn't really mean anything. I was just generalizing something
>>> that's been around forever.*  It's simple enough that it must be in use
>>> somewhere.  I just haven't noticed it.  I looked up the linux kernal
>>> seqlock documentation and it specifically says not to use pointers in
>>> seqlock protected data and no idea why that is unless the linux kernel
>>> is doing something weird with memory mapping.
>>>
>>> Like seqlock, it is obstruction-free.  If you have qsbr (RCU) or ebr,
>>> that would be a better choice.  It might be good for libraries where
>>> the memory reclamation is hidden from the application.
>>>
>>> * tangentially related to something that I was working on which if far
>>> more perverse but mostly in a solution that is looking for a problem
>>> phase so it probably won't go anywhere.
>>
>> I threw together a really quick and dirty test to see how much
>> overhead all those extra loads would cause.  Doesn't appear to
>> add any.  I will have to add it to the proxies project testcase
>> for more extensive testing but it will take a bit of work since
>> all the other proxies implement BasicLock and consequential RCU
>> readers do not.
> 
> This is what the code I did a quick and dirty test with looked like
> 
> 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));
> 
> 
> As you can see, not a heck of lot of room in that loop
> for the cpu pipeline to deal with the extra load and
> conditional logic.
> 

It seems like cseq_retry on "every" iteration with its, two?, #LoadStore 
| #LoadLoad barriers is a bit much. Now that I have Relacy working fine 
on my end, and it has all I need for simulating even advanced RCU+SMR 
algos. Well, I will get back into it from time to time. Actually, can 
you get it working? Its a neat way to simulate your sync experiments.

Wait I count an acquire on the item->next.load and then two acquires 
from cseq_retry? Am I missing something critical here Joe?

https://github.com/dvyukov/relacy

Its header only.
Technical Details
Message-ID: <11am17q$rl8q$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <118f4vv$3plsv$1@dont-email.me> <11ag8ue$2nvjl$1@dont-email.me> <11alo51$nmur$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!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
Date: Tue, 13 Oct 2026 12:36:23 -0700
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <11am17q$rl8q$1@dont-email.me>
References: <118f4vv$3plsv$1@dont-email.me> <11ag8ue$2nvjl$1@dont-email.me>
 <11alo51$nmur$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 13 Oct 2026 19:36:27 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="906522"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/myh6Sl5RcTaeJNLVxf1WhFJUqWmjEg3c="; posting-host="094496f6b743c51c3f22a7000b0b8b16"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:7q+MY6cb8aTqz2T7JKzxae2Gtxk= sha256:tVQvKu5+M4C4B0oChijS4KOIPp55NAxfcrAOffpiORs=
	sha1:7zdZr+Ya7VXnPpaMQ4Sxg0uha/s= sha256:/J0pFkeNSTQqyHmaDb/Qrf3iv7lnQf+7rsQ9a5Vi+NE=
In-Reply-To: <11alo51$nmur$1@dont-email.me>
Content-Language: en-US