public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Waiman Long <longman@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, Joe Mario <jmario@redhat.com>,
	Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [PATCH v3] locking/rwsem: Exit read lock slowpath if queue empty & no writer
Date: Wed, 8 Aug 2018 11:24:01 +0100	[thread overview]
Message-ID: <20180808102401.GC28557@arm.com> (raw)
In-Reply-To: <55866c24-ff40-22cb-1390-6c9055bd2cb7@redhat.com>

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

  reply	other threads:[~2018-08-08 10:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24 19:10 [PATCH v3] locking/rwsem: Exit read lock slowpath if queue empty & no writer Waiman Long
2018-07-27  0:02 ` Davidlohr Bueso
2018-07-27 13:33 ` Will Deacon
2018-08-07 23:29 ` Waiman Long
2018-08-08 10:24   ` Will Deacon [this message]
2018-09-10 10:10 ` [tip:locking/core] " tip-bot for Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180808102401.GC28557@arm.com \
    --to=will.deacon@arm.com \
    --cc=dave@stgolabs.net \
    --cc=jmario@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox