mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Waiman Long <Waiman.Long@hp.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, Jason Low <jason.low2@hp.com>,
	Scott J Norton <scott.norton@hp.com>,
	Douglas Hatch <doug.hatch@hp.com>
Subject: Re: [PATCH v2] locking/rwsem: reduce spinlock contention in wakeup after up_read/up_write
Date: Thu, 23 Apr 2015 14:31:30 -0700	[thread overview]
Message-ID: <1429824690.10273.41.camel@stgolabs.net> (raw)
In-Reply-To: <1429813449-19641-1-git-send-email-Waiman.Long@hp.com>

It would be nice to not run into this by accident. Please CC all
relevant parties ;)

On Thu, 2015-04-23 at 14:24 -0400, Waiman Long wrote:
> In up_read()/up_write(), rwsem_wake() will be called whenever it
> detects that some writers/readers are waiting. The rwsem_wake()
> function will take the wait_lock and call __rwsem_do_wake() to do
> the real wakeup.  This can be a problem especially for up_read()
> where many readers can potentially call rwsem_wake() at more or less
> the same time even though a single call should be enough. This will
> cause contention in the wait_lock cacheline resulting in delay of
> the up_read/up_write operations.

Ok.

> This patch makes the wait_lock taking and the call to __rwsem_do_wake()
> optional if at least one spinning writer is present.

But if the lock is taken by readers, like you suggest above, there
cannot be any active spinners. We always block in these cases.

Thanks,
Davidlohr


  parent reply	other threads:[~2015-04-23 21:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 18:24 Waiman Long
2015-04-23 20:42 ` Jason Low
2015-04-24 14:55   ` Waiman Long
2015-04-23 21:31 ` Davidlohr Bueso [this message]
2015-04-24 14:56   ` 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=1429824690.10273.41.camel@stgolabs.net \
    --to=dave@stgolabs.net \
    --cc=Waiman.Long@hp.com \
    --cc=doug.hatch@hp.com \
    --cc=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=scott.norton@hp.com \
    /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

all inboxes | Powered by JetHome®