[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250125003139.2564269-4-dxu@dxuuu.xyz>
Date: Fri, 24 Jan 2025 17:31:42 -0700
From: Daniel Xu <dxu@...uu.xyz>
To: dxu@...uu.xyz
Cc: boqun.feng@...il.com,
linux-kernel@...r.kernel.org,
longman@...hat.com,
mingo@...hat.com,
paulmck@...nel.org,
peterz@...radead.org,
will@...nel.org,
fweimer@...hat.co
Subject: Re: [PATCH] seqlock: Use WRITE_ONCE() when updating sequence
Hi all,
Thanks for the very interesting discussion - I learned quite a few things.
Please let me know if the following is a correct summary:
1. The intent of the change is valid. New compiler optimizations may break
current assumptions.
2. My proposed change is unacceptable due to bad codegen from GCC. Clang is OK
b/c it can optimize the `WRITE_ONCE(.., READ_ONCE(..) + 1)` into a single `incl`
instruction.
3. The counter-proposed INC_ONCE() change from Peter is also incorrect, despite
codegen for both clang and GCC currently being correct. There is no guarantee
that the GCC variant of INC_ONCE() will continue to work in the future.
It sounds like the next step for this is to follow up w/ GCC folks about improving
codegen for `WRITE_ONCE(.., READ_ONCE(..) + 1`)`.
Does that sound right?
Thanks,
Daniel
Powered by blists - more mailing lists