lkml.org 
[lkml]   [2018]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2018-08-08 12:25    [W:0.085 / U:17.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site