From: Waiman Long <longman@redhat.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Davidlohr Bueso <dave@stgolabs.net>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Oleg Nesterov <oleg@redhat.com>,
Amir Goldstein <amir73il@gmail.com>, Jan Kara <jack@suse.cz>,
Waiman Long <longman@redhat.com>
Subject: [RFC PATCH v2 2/2] locking/percpu-rwsem: Mark rwsem as non-spinnable in percpu_rwsem_release()
Date: Mon, 14 May 2018 15:31:07 -0400 [thread overview]
Message-ID: <1526326267-22501-3-git-send-email-longman@redhat.com> (raw)
In-Reply-To: <1526326267-22501-1-git-send-email-longman@redhat.com>
The percpu_rwsem_release() is called when the ownership of the embedded
rwsem is to be transferred to another task. The new owner, however, may
take a while to get the ownership of the lock via percpu_rwsem_acquire().
During that period, the rwsem is now marked as writer-owned with no
optimistic spinning.
Signed-off-by: Waiman Long <longman@redhat.com>
---
include/linux/percpu-rwsem.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index b1f37a8..dd37102 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -131,16 +131,16 @@ static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem,
bool read, unsigned long ip)
{
lock_release(&sem->rw_sem.dep_map, 1, ip);
-#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
if (!read)
- sem->rw_sem.owner = NULL;
-#endif
+ rwsem_set_writer_owned_nospin(&sem->rw_sem);
}
static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem,
bool read, unsigned long ip)
{
lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip);
+ if (!read)
+ rwsem_set_writer_owned(&sem->rw_sem, current);
}
#endif
--
1.8.3.1
next prev parent reply other threads:[~2018-05-14 19:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 19:31 [RFC PATCH v2 0/2] locking/rwsem: Fix DEBUG_RWSEM warning from thaw_sup Waiman Long
2018-05-14 19:31 ` [RFC PATCH v2 1/2] locking/rwsem: Add a new RWSEM_WRITER_OWNED_NOSPIN flag Waiman Long
2018-05-15 6:59 ` Amir Goldstein
2018-05-15 8:25 ` Peter Zijlstra
2018-05-14 19:31 ` Waiman Long [this message]
2018-05-15 5:42 ` [RFC PATCH v2 2/2] locking/percpu-rwsem: Mark rwsem as non-spinnable in percpu_rwsem_release() Amir Goldstein
2018-05-15 7:04 ` Amir Goldstein
2018-05-15 13:45 ` Waiman Long
2018-05-15 8:35 ` Peter Zijlstra
2018-05-15 9:00 ` Jan Kara
2018-05-15 11:33 ` Oleg Nesterov
2018-05-15 8:51 ` Peter Zijlstra
2018-05-15 11:06 ` Oleg Nesterov
2018-05-15 11:51 ` Peter Zijlstra
2018-05-15 12:45 ` Oleg Nesterov
2018-05-15 12:58 ` Peter Zijlstra
2018-05-15 13:57 ` Waiman Long
2018-05-15 14:00 ` Matthew Wilcox
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=1526326267-22501-3-git-send-email-longman@redhat.com \
--to=longman@redhat.com \
--cc=amir73il@gmail.com \
--cc=dave@stgolabs.net \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tytso@mit.edu \
/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).