From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>,
Phil Auld <pauld@redhat.com>
Subject: Re: [PATCH v2 5/5] locking/rwsem: Remove reader optimistic spinning
Date: Tue, 8 Dec 2020 11:07:04 +0100 [thread overview]
Message-ID: <20201208100704.GU2414@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201121041416.12285-6-longman@redhat.com>
On Fri, Nov 20, 2020 at 11:14:16PM -0500, Waiman Long wrote:
> @@ -1032,40 +901,16 @@ rwsem_down_read_slowpath(struct rw_semaphore *sem, int state, long count)
> *
> * We can take the read lock directly without doing
> * rwsem_optimistic_spin() if the conditions are right.
This comment no longer makes sense..
> - * Also wake up other readers if it is the first reader.
> */
> - if (!(count & (RWSEM_WRITER_LOCKED | RWSEM_FLAG_HANDOFF)) &&
> - rwsem_no_spinners(sem)) {
> + if (!(count & (RWSEM_WRITER_LOCKED | RWSEM_FLAG_HANDOFF))) {
> rwsem_set_reader_owned(sem);
> lockevent_inc(rwsem_rlock_steal);
> - if (rcnt == 1)
> - goto wake_readers;
> - return sem;
> - }
>
> - /*
> - * Save the current read-owner of rwsem, if available, and the
> - * reader nonspinnable bit.
> - */
> - waiter.last_rowner = owner;
> - if (!(waiter.last_rowner & RWSEM_READER_OWNED))
> - waiter.last_rowner &= RWSEM_RD_NONSPINNABLE;
> -
> - if (!rwsem_can_spin_on_owner(sem, RWSEM_RD_NONSPINNABLE))
> - goto queue;
> -
> - /*
> - * Undo read bias from down_read() and do optimistic spinning.
> - */
> - atomic_long_add(-RWSEM_READER_BIAS, &sem->count);
> - adjustment = 0;
> - if (rwsem_optimistic_spin(sem, false)) {
since we're removing the optimistic spinning entirely on the read side.
Also, I was looking at skipping patch #4, which mucks with the reader
wakeup logic, and afaict this removal doesn't really depend on it.
Or am I missing something?
next prev parent reply other threads:[~2020-12-08 10:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-21 4:14 [PATCH v2 0/5] locking/rwsem: Rework reader optimistic spinning Waiman Long
2020-11-21 4:14 ` [PATCH v2 1/5] locking/rwsem: Pass the current atomic count to rwsem_down_read_slowpath() Waiman Long
2020-12-09 18:38 ` [tip: locking/core] " tip-bot2 for Waiman Long
2020-11-21 4:14 ` [PATCH v2 2/5] locking/rwsem: Prevent potential lock starvation Waiman Long
2020-11-26 8:12 ` [locking/rwsem] 25d0c60b0e: vm-scalability.throughput 316.2% improvement kernel test robot
2020-12-09 18:38 ` [tip: locking/core] locking/rwsem: Prevent potential lock starvation tip-bot2 for Waiman Long
2020-11-21 4:14 ` [PATCH v2 3/5] locking/rwsem: Enable reader optimistic lock stealing Waiman Long
2020-12-09 18:38 ` [tip: locking/core] " tip-bot2 for Waiman Long
2020-11-21 4:14 ` [PATCH v2 4/5] locking/rwsem: Wake up all waiting readers if RWSEM_WAKE_READ_OWNED Waiman Long
2020-11-24 3:15 ` [locking/rwsem] c9847a7f94: aim7.jobs-per-min -91.8% regression kernel test robot
2020-11-21 4:14 ` [PATCH v2 5/5] locking/rwsem: Remove reader optimistic spinning Waiman Long
2020-11-23 15:53 ` [locking/rwsem] 10a59003d2: unixbench.score -25.5% regression kernel test robot
2020-11-23 19:28 ` Waiman Long
2020-12-08 3:56 ` [PATCH v2 5/5] locking/rwsem: Remove reader optimistic spinning Davidlohr Bueso
2020-12-08 10:07 ` Peter Zijlstra [this message]
2020-12-08 15:29 ` Waiman Long
2020-12-09 18:38 ` [tip: locking/core] " tip-bot2 for Waiman Long
2020-12-08 14:57 ` [PATCH v2 0/5] locking/rwsem: Rework " Peter Zijlstra
2020-12-08 16:33 ` Waiman Long
2020-12-08 17:02 ` Peter Zijlstra
2020-12-08 17:30 ` Waiman Long
-- strict thread matches above, loose matches on Subject: below --
2025-05-27 9:08 [PATCH v2 5/5] locking/rwsem: Remove " Krcka, Tomas
2026-03-24 14:36 ` David Woodhouse
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=20201208100704.GU2414@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=pauld@redhat.com \
--cc=will@kernel.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