Re: [PATCH] seqlock: Use WRITE_ONCE() when updating sequence
Peter Zijlstra <[email protected]>
| Newsgroups | org.kernel.vger.linux-toolchains,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Dec 19, 2024 at 05:45:15PM +0100, Florian Weimer wrote: > > Peter's "(*(volatile unsigned int *)&s->sequence)++;" qualifies as sane. > > I think the reference was originally to machine code. Correct; however more tinkering with godbolt got me: https://godbolt.org/z/6xoxjdYPx Where we can see that clang can even optimize the WRITE_ONCE(foo, READ_ONCE(foo) + 1) case, which I though it would not be able to do. So perhaps we just need to get GCC fixed.