OSDN Git Service

sbitmap: replace CAS with atomic and
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 22 Nov 2020 15:35:47 +0000 (15:35 +0000)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Dec 2020 00:12:49 +0000 (17:12 -0700)
commitc3250c8d2451ffbea14ba95164c59edd943ee4be
treed15f81f25f233c6576b615fdf44bdf77c3bc4696
parent661d4f55a79483aee4970a76e3bd9d4cdc74ac79
sbitmap: replace CAS with atomic and

sbitmap_deferred_clear() does CAS loop to propagate cleared bits,
replace it with equivalent atomic bitwise and. That's slightly faster
and makes wait-free instead of lock-free as before.

The atomic can be relaxed (i.e. barrier-less) because following
sbitmap_get*() deal with synchronisation, see comments in
sbitmap_queue_clear().

It's ok to cast to atomic_long_t, that's what bitops/lock.h does.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/sbitmap.c