[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141216090128.GU3337@twins.programming.kicks-ass.net>
Date: Tue, 16 Dec 2014 10:01:28 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Baoquan He <bhe@...hat.com>
Cc: linux-kernel@...r.kernel.org, mingo@...hat.com, Waiman.Long@...com
Subject: Re: [PATCH] locking/rwlocks: clean up of qrwlock
On Tue, Dec 16, 2014 at 02:00:40PM +0800, Baoquan He wrote:
> In queue_read_lock_slowpath, when writer count becomes 0, we need
> increment the read count and get the lock. Then need call
> rspin_until_writer_unlock to check again if an incoming writer
> steals the lock in the gap. But in rspin_until_writer_unlock
> it only checks the writer count, namely low 8 bit of lock->cnts,
> no need to subtract the reader count unit specifically. So remove
> that subtraction to make it clearer, rspin_until_writer_unlock
> just takes the actual lock->cnts as the 2nd argument.
>
> And also change the code comment in queue_write_lock_slowpath to
> make it more exact and explicit.
>
> Signed-off-by: Baoquan He <bhe@...hat.com>
> ---
> kernel/locking/qrwlock.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/locking/qrwlock.c b/kernel/locking/qrwlock.c
> index f956ede..ae66c10 100644
> --- a/kernel/locking/qrwlock.c
> +++ b/kernel/locking/qrwlock.c
> @@ -76,7 +76,7 @@ void queue_read_lock_slowpath(struct qrwlock *lock)
> while (atomic_read(&lock->cnts) & _QW_WMASK)
> cpu_relax_lowlatency();
>
> - cnts = atomic_add_return(_QR_BIAS, &lock->cnts) - _QR_BIAS;
> + cnts = atomic_add_return(_QR_BIAS, &lock->cnts);
> rspin_until_writer_unlock(lock, cnts);
Did you actually look at the ASM generated? I suspect your change makes
it bigger.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists