Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [PATCH 3/4] locking/rwbase: Fix rwbase_write_lock() vs __rwbase_read_lock() | Date | Tue, 14 Sep 2021 09:45:12 +0200 |
| |
On Thu, Sep 09 2021 at 12:59, Peter Zijlstra wrote:
> Boqun noticed that the write-trylock sequence of load+set is broken in > rwbase_write_lock()'s wait-loop since they're not both under the same > wait_lock instance.
Confused.
lock(); A
for (; atomic_read(readers);) { ... unlock(); .. lock(); B }
atomic_set(); unlock(); A or B
The read/set is always in the same lock instance.
> Restructure the code to make this more obvious and correct.
I agree that it's easier to read, but I disagree that it makes the code more correct.
Thanks,
tglx
| |