From: Jason Low <jason.low2@hp.com>
To: Waiman Long <Waiman.Long@hpe.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>,
Dave Chinner <david@fromorbit.com>,
Scott J Norton <scott.norton@hpe.com>,
Douglas Hatch <doug.hatch@hpe.com>,
jason.low2@hpe.com
Subject: Re: [PATCH v2] locking/rwsem: Add reader-owned state to the owner field
Date: Mon, 09 May 2016 11:44:31 -0700 [thread overview]
Message-ID: <1462819471.2701.2.camel@j-VirtualBox> (raw)
In-Reply-To: <1462580424-40333-1-git-send-email-Waiman.Long@hpe.com>
On Fri, 2016-05-06 at 20:20 -0400, Waiman Long wrote:
> Currently, it is not possible to determine for sure if a reader
> owns a rwsem by looking at the content of the rwsem data structure.
> This patch adds a new state RWSEM_READER_OWNED to the owner field
> to indicate that readers currently own the lock. This enables us to
> address the following 2 issues in the rwsem optimistic spinning code:
>
> 1) rwsem_can_spin_on_owner() will disallow optimistic spinning if
> the owner field is NULL which can mean either the readers own
> the lock or the owning writer hasn't set the owner field yet.
> In the latter case, we miss the chance to do optimistic spinning.
>
> 2) While a writer is spinning and a reader takes the lock, the writer
> will continue to spin in the main rwsem_optimistic_spin() loop as
> the owner is NULL.
>
> Adding the new state will allow optimistic spinning to go forward as
> long as the owner field is not RWSEM_READER_OWNED and the owner is
> running, if set, but stop immediately when that state has been reached.
>
> On a 4-socket Haswell machine running on a 4.6-rc1 based kernel, the
> fio test with multithreaded randrw and randwrite tests on the same
> file on a XFS partition on top of a NVDIMM were run, the aggregated
> bandwidths before and after the patch were as follows:
>
> Test BW before patch BW after patch % change
> ---- --------------- -------------- --------
> randrw 988 MB/s 1192 MB/s +21%
> randwrite 1513 MB/s 1623 MB/s +7.3%
>
> The perf profile of the rwsem_down_write_failed() function in randrw
> before and after the patch were:
>
> 19.95% 5.88% fio [kernel.vmlinux] [k] rwsem_down_write_failed
> 14.20% 1.52% fio [kernel.vmlinux] [k] rwsem_down_write_failed
>
> The actual CPU cycles spend in rwsem_down_write_failed() dropped from
> 5.88% to 1.52% after the patch.
>
> The xfstests was also run and no regression was observed.
>
> Signed-off-by: Waiman Long <Waiman.Long@hpe.com>
Acked-by: Jason Low <jason.low2@hp.com>
next prev parent reply other threads:[~2016-05-09 18:45 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-07 0:20 [PATCH v2] locking/rwsem: Add reader-owned state to the owner field Waiman Long
2016-05-07 4:56 ` Ingo Molnar
2016-05-08 3:04 ` Waiman Long
2016-05-09 8:27 ` Peter Zijlstra
2016-05-10 2:24 ` Waiman Long
2016-05-10 7:02 ` Peter Zijlstra
2016-05-09 18:44 ` Jason Low [this message]
2016-05-10 13:03 ` Davidlohr Bueso
2016-05-11 22:04 ` Peter Hurley
2016-05-12 20:15 ` Waiman Long
2016-05-12 21:27 ` Peter Hurley
2016-05-12 23:13 ` Waiman Long
2016-05-13 15:07 ` Peter Zijlstra
2016-05-13 17:58 ` Peter Hurley
2016-05-15 14:47 ` Waiman Long
2016-05-16 11:09 ` Peter Zijlstra
2016-05-16 12:17 ` Paul E. McKenney
2016-05-16 14:17 ` Peter Hurley
2016-05-16 17:22 ` Paul E. McKenney
2016-05-17 19:46 ` Peter Hurley
2016-05-17 19:53 ` Peter Hurley
2016-05-16 17:50 ` Peter Zijlstra
2016-05-17 19:15 ` Peter Hurley
2016-05-17 19:46 ` Paul E. McKenney
2016-05-18 11:05 ` Peter Zijlstra
2016-05-18 15:56 ` Waiman Long
2016-05-18 17:28 ` Paul E. McKenney
2016-05-18 17:26 ` Paul E. McKenney
2016-05-19 9:00 ` Peter Zijlstra
2016-05-19 13:43 ` Paul E. McKenney
2016-05-19 1:37 ` Dave Chinner
2016-05-19 8:32 ` Peter Zijlstra
2016-05-20 22: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=1462819471.2701.2.camel@j-VirtualBox \
--to=jason.low2@hp.com \
--cc=Waiman.Long@hpe.com \
--cc=dave@stgolabs.net \
--cc=david@fromorbit.com \
--cc=doug.hatch@hpe.com \
--cc=jason.low2@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=scott.norton@hpe.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;
as well as URLs for NNTP newsgroup(s).