[PATCH 3/7] Remove atomic_bit_set/bit_test_set

H.J. Lu hjl.tools@gmail.com
Tue Jul 12 19:11:07 GMT 2022


On Tue, Jul 12, 2022 at 11:44 AM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi,
>
> I don't believe it could make a difference since it isn't performance critical code.
> Note that several similar fetch_or/fetch_and are used which do not optimize into a

Only the operations with test have this issue.  Simple fetch_or and
fetch_and are
OK.

> bitset operation, so even if we fix this particular case to use unsigned, there are many
> others. IIRC there is even a fetch_or with zero which is kind of useless!
>
> More importantly, it raises a question for locking: we currently use a compare-exchange
> for each lock and unlock. If compare-exchange has higher overheads than other atomics
> then we should investigate more efficient locking sequences.

compare-exchange can be very expensive under contention.

> Cheers,
> Wilco



-- 
H.J.


More information about the Libc-alpha mailing list