Re: [PATCH 1/4] locking/rwsem: Avoid stale ->count for rwsem_down_write_failed()

From: Davidlohr Bueso
Date: Mon May 09 2016 - 10:30:05 EST


On Sun, 08 May 2016, Peter Hurley wrote:

On 05/08/2016 09:56 PM, Davidlohr Bueso wrote:
The field is obviously updated w.o the lock and needs a READ_ONCE
while waiting for lock holder(s) to go away, just like we do with
all other ->count accesses.

This isn't actually fixing a bug because it's passed through
several full barriers which will force reloading from sem->count.

Yes.


I think the patch is ok if you want it just for consistency anyway,
but please change $subject and changelog.

Yeah, I wasn't actually concerned about a specific bug, it was more
just for documentation and consistency. This code has been like this
for ever, but it would still be good to have the READ_ONCE. It is
slightly suboptimal to use, but I do not see any real impact either.

Thanks,
Davidlohr