All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Waiman Long <Waiman.Long@hp.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Scott J Norton <scott.norton@hp.com>,
	Douglas Hatch <doug.hatch@hp.com>
Subject: Re: [PATCH v4 1/2] locking/qrwlock: Better optimization for interrupt context readers
Date: Thu, 18 Jun 2015 13:41:10 +0100	[thread overview]
Message-ID: <20150618124110.GC5168@arm.com> (raw)
In-Reply-To: <1434594023-43589-2-git-send-email-Waiman.Long@hp.com>

On Thu, Jun 18, 2015 at 03:20:22AM +0100, Waiman Long wrote:
> The qrwlock is fair in the process context, but becoming unfair when
> in the interrupt context to support use cases like the tasklist_lock.
> 
> The current code isn't that well-documented on what happens when
> in the interrupt context. The rspin_until_writer_unlock() will only
> spin if the writer has gotten the lock. If the writer is still in the
> waiting state, the increment in the reader count will cause the writer
> to remain in the waiting state and the new interrupt context reader
> will get the lock and return immediately. The current code, however,
> do an additional read of the lock value which is not necessary as
> the information have already been there in the fast path. This may
> sometime cause an additional cacheline transfer when the lock is
> highly contended.
> 
> This patch passes the lock value information gotten in the fast path
> to the slow path to eliminate the additional read. It also document
> the action for the interrupt context readers more clearly.
> 
> Signed-off-by: Waiman Long <Waiman.Long@hp.com>
> ---
>  include/asm-generic/qrwlock.h |    4 ++--
>  kernel/locking/qrwlock.c      |   13 +++++++------
>  2 files changed, 9 insertions(+), 8 deletions(-)

LGTM:

  Reviewed-by: Will Deacon <will.deacon@arm.com>

Will

  reply	other threads:[~2015-06-18 12:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18  2:20 [PATCH v4 0/2] locking/qrwlock: More optimizations in qrwlock Waiman Long
2015-06-18  2:20 ` [PATCH v4 1/2] locking/qrwlock: Better optimization for interrupt context readers Waiman Long
2015-06-18 12:41   ` Will Deacon [this message]
2015-06-18  2:20 ` [PATCH v4 2/2] locking/qrwlock: Don't contend with readers when setting _QW_WAITING 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=20150618124110.GC5168@arm.com \
    --to=will.deacon@arm.com \
    --cc=Waiman.Long@hp.com \
    --cc=arnd@arndb.de \
    --cc=doug.hatch@hp.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.