[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k0jjeh2v.ffs@tglx>
Date: Tue, 14 Sep 2021 09:45:12 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>, boqun.feng@...il.com
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org,
Ingo Molnar <mingo@...nel.org>,
Juri Lelli <juri.lelli@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Davidlohr Bueso <dave@...olabs.net>,
Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Mike Galbraith <efault@....de>,
Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: Re: [PATCH 3/4] locking/rwbase: Fix rwbase_write_lock() vs
__rwbase_read_lock()
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
Powered by blists - more mailing lists