Re: [PATCH 1/1] sbitmap: Replace cmpxchg with xchg

From: Jens Axboe
Date: Mon Jul 01 2019 - 15:44:48 EST


On 5/23/19 9:39 AM, Pavel Begunkov (Silence) wrote:
> From: Pavel Begunkov <asml.silence@xxxxxxxxx>
>
> cmpxchg() with an immediate value could be replaced with less expensive
> xchg(). The same true if new value don't _depend_ on the old one.
>
> In the second block, atomic_cmpxchg() return value isn't checked, so
> after atomic_cmpxchg() -> atomic_xchg() conversion it could be replaced
> with atomic_set(). Comparison with atomic_read() in the second chunk was
> left as an optimisation (if that was the initial intention).

Applied, thanks.

--
Jens Axboe