On Tue, May 23, 2023 at 09:22:13AM +0100, John Garry wrote: > On 22/05/2023 22:05, Tian Lan wrote: > > + if (test_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags) || > > + test_and_set_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags)) > > We could also add a bitops wrapper function for this. I don't know what name > to use, maybe test_and_set_bit_fast_but_racy() - I'm half joking about the > name I don't think this pattern is any more racy than a solo test_and_set_bit(). Maybe "test_then_test_and_set_bit()"?