Arachne icon indicating copy to clipboard operation
Arachne copied to clipboard

Is it necessary to use cmpxchg when clear a bit of MaskAndCount?

Open lastweek opened this issue 5 years ago • 0 comments

Hi,

Quick question about MaskAndCount.

It could be read by multiple threads concurrently, thus a final compare_and_swap is necessary to guarantee atomicity.

But is it only being cleared by one single thread (the one who owns it)? If so, it seems a simple atomic clear_bit() is enough rather than full-fledged cmpxchg. Related code here.

lastweek avatar Jul 04 '19 18:07 lastweek