Messages in this thread | ![/](/images/icornerl.gif) | | From | Uros Bizjak <> | Date | Tue, 9 Apr 2024 18:53:30 +0200 | Subject | Re: [PATCH 2/6] locking/atomic/x86: Rewrite x86_32 arch_atomic64_{,fetch}_{and,or,xor}() functions |
| |
On Tue, Apr 9, 2024 at 6:34 PM Mark Rutland <mark.rutland@arm.com> wrote:
> > Something like this: > > > > --cut here-- > > /* > > * This function is intended to preload the value from atomic64_t > > * location in a non-atomic way. The read might be torn, but can > > * safely be consumed by the compare-and-swap loop. > > */ > > static __always_inline s64 arch_atomic64_read_tearable(atomic64_t *v) > > { > > /* > > * See the comment in arch_atomic_read() on why we use > > * __READ_ONCE() instead of READ_ONCE_NOCHECK() here. > > */ > > return __READ_ONCE(v->counter); > > } > > --cut here-- > > Yeah, something of that shape. > > Having thought for a bit longer, it's probably better to use '_torn' rather > than '_tearable' (i.e. name this arch_atomic64_read_torn()).
How about we simply name the function
arch_atomic64_read_nonatomic()
in the sense that it reads atomic64_t variables in a non-atomic way?
Uros.
| ![\](/images/icornerr.gif) |