[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 8 Aug 2018 11:24:01 +0100
From: Will Deacon <will.deacon@....com>
To: Waiman Long <longman@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Joe Mario <jmario@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [PATCH v3] locking/rwsem: Exit read lock slowpath if queue empty
& no writer
Hi Waiman,
On Tue, Aug 07, 2018 at 07:29:49PM -0400, Waiman Long wrote:
> On 07/24/2018 03:10 PM, Waiman Long wrote:
> > diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
> > index 3064c50..01fcb80 100644
> > --- a/kernel/locking/rwsem-xadd.c
> > +++ b/kernel/locking/rwsem-xadd.c
> > @@ -233,8 +233,19 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem,
> > waiter.type = RWSEM_WAITING_FOR_READ;
> >
> > raw_spin_lock_irq(&sem->wait_lock);
> > - if (list_empty(&sem->wait_list))
> > + if (list_empty(&sem->wait_list)) {
> > + /*
> > + * In case the wait queue is empty and the lock isn't owned
> > + * by a writer, this reader can exit the slowpath and return
> > + * immediately as its RWSEM_ACTIVE_READ_BIAS has already
> > + * been set in the count.
> > + */
> > + if (atomic_long_read(&sem->count) >= 0) {
> > + raw_spin_unlock_irq(&sem->wait_lock);
> > + return sem;
> > + }
> > adjustment += RWSEM_WAITING_BIAS;
> > + }
> > list_add_tail(&waiter.list, &sem->wait_list);
> >
> > /* we're now waiting on the lock, but no longer actively locking */
>
> Will this patch be eligible to go into 4.19 or 4.20?
It's probably worth reposting with the Acks you've received, so that Ingo
can easily pick it up into -tip (but it might be a bit close for 4.19 at
this point).
Will
Powered by blists - more mailing lists