🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Consequential RCU

#499
From: Joseph Seigh
Date: Tue, 13 Oct 2026 17:01
59 lines
3480 bytes
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.
Technical Details
Message-ID: <11alo51$nmur$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>

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: Joseph Seigh <jseigh_es00@xemaps.com>
Newsgroups: comp.lang.c++
Subject: Re: Consequential RCU
Date: Tue, 13 Oct 2026 13:01:21 -0400
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <11alo51$nmur$1@dont-email.me>
References: <118f4vv$3plsv$1@dont-email.me> <11ag8ue$2nvjl$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 17:01:22 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="777179"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19ej/GSLIHyHIUEGT/mX5Ft"; posting-host="4e618709ff48547e03802233e0cd58cb"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:eMcmBTNi4bn4N/IYkqXsVZn6FNc= sha256:+A9zHBEB509BighqrUM3Ly+sXOWdiPaUNbiADqcmnG4=
	sha1:uJ/35LCxK5WN/Nq6J7SO9gKXa00= sha256:zYH+7BXM1AB8tQCKuW5Jkl+u+hFIhxh+WlJMcfVqpCQ=
Content-Language: en-US
In-Reply-To: <11ag8ue$2nvjl$1@dont-email.me>