MINOR: pools: always use atomic ops to maintain counters
authorWilly Tarreau <w@1wt.eu>
Sat, 17 Apr 2021 16:06:57 +0000 (18:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Apr 2021 13:24:33 +0000 (15:24 +0200)
commit2b5579f6da2b24bfcc7fefb4ba06d4a4aba2eb05
treeabd4b5cea9e67205d9513eab398e9fbbe5e102a2
parent13843641e5d423e9c5939f3a3ebea0446491e247
MINOR: pools: always use atomic ops to maintain counters

A part of the code cannot be factored out because it still uses non-atomic
inc/dec for pool->used and pool->allocated as these are located under the
pool's lock. While it can make sense in terms of bus cycles, it does not
make sense in terms of code normalization. Further, some operations were
still performed under a lock that could be totally removed via the use of
atomic ops.

There is still one occurrence in pool_put_to_shared_cache() in the locked
code where pool_free_area() is called under the lock, which must absolutely
be fixed.
include/haproxy/pool.h
src/pool.c