On Mon, Dec 1, 2014 at 7:29 PM, Jeff Layton <jeff.layton@xxxxxxxxxxxxxxx> wrote: > There are two atomicity "concerns" here... > > The main thing is to ensure that we use set_bit or test_and_set_bit to > set the flag. What we *can't* use is __set_bit which is non-atomic > or we'd end up hitting the exact problem you're talking about (possibly > changing an unrelated flag in the field that happened to flip at nearly > the same time). > > What's not necessary here is to use test_and_set_bit since all of this > is done under spinlock anyway. In principle, we could do a test_bit and > then follow that up with a set_bit if it's clear. But, I don't think > that really buys us much, and tend to find the test_and_set_bit to be > clearer when reading the code. Fair enough. I too would be surprised if you could actually measure that performance difference in the thread kill code. Cheers, Trond -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html