lkml.org 
[lkml]   [2021]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 00/13] [RFC] Rust support
From
Date
On 16/04/21 09:09, Peter Zijlstra wrote:
> Well, the obvious example would be seqlocks. C11 can't do them

Sure it can. C11 requires annotating with (the equivalent of) READ_ONCE
all reads of seqlock-protected fields, but the memory model supports
seqlocks just fine.

> Simlar thing for RCU; C11 can't optimally do that

Technically if you know what you're doing (i.e. that you're not on
Alpha) you can do RCU using a relaxed load followed by an
atomic_signal_fence(memory_order_consume). Which I agree is horrible
and not entirely within the standard, but it works in practice. The
Linux implementation of memory barriers, atomic RMW primitives,
load-acquire/store-release etc. is also completely outside the standard,
so it's not much different and more portable.

The only thing that I really, really miss when programming with C11
atomics is smp_mb__{before,after}_atomic().

Paolo

\
 
 \ /
  Last update: 2021-04-17 16:54    [W:0.137 / U:5.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site