Article View: comp.lang.c++
Article #573Re: Consequential RCU
From: Chris M. Thomasson
Date: Thu, 15 Oct 2026 18:49
Date: Thu, 15 Oct 2026 18:49
72 lines
4073 bytes
4073 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));
Oh shit. This looks like it can be _potential_ "livelock" nation under
some sustained periods of "heavy enough" load? Can we iterate the whole
list before many (n) retrys have occurred? Or how many retrys on average
does it take to iterate a decent sized list from head to tail? Writers
churning along in the background...
>
>
> 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.
>
Indeed!
Technical Details
Message-ID:
<11ar78l$2m3md$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-mailReferences:
<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: Thu, 15 Oct 2026 11:49:54 -0700 Organization: A noiseless patient Spider Lines: 72 Message-ID: <11ar78l$2m3md$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: Thu, 15 Oct 2026 18:49:58 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2821837"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19K+FIfTXROEcoouidMQCfU4R58Ryvk3vA="; posting-host="979f69778276c51b653f13045ccea5e5" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:gFTz5xhNBLZ2yfuZlgK/AqZMe3Q= sha256:t5WVKJMjoq4KXVO/+pZj8jnBiJD8LoZP+nfDQeZ0nbc= sha1:f/wkaq9bMFd/Yjv3t0gLT1ryba8= sha256:LOlpObpW9ygZ5c6/c+m8ZuOGLVwAjo+N/Lwswj2EmXw= Content-Language: en-US In-Reply-To: <11alo51$nmur$1@dont-email.me>