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>,
Matthew Wilcox <willy@infradead.org>,
Waiman Long <longman@redhat.com>
Subject: [PATCH v4 0/2] locking/rwsem: Fix DEBUG_RWSEM warning from thaw_super()
Date: Tue, 15 May 2018 17:49:49 -0400 [thread overview]
Message-ID: <1526420991-21213-1-git-send-email-longman@redhat.com> (raw)
v4:
- Repurpose bit 0 of the owner field as the unknown owner bit.
- Incorporate comments from reviewers.
v3:
- Modify patch 1 to not expose any new rwsem owner related function.
- Modify patch 2 to make percpu_rwsem_release() and
percpu_rwsem_acquire() set the owner field directly, if applicable.
This patchset aims to fix the DEBUG_RWSEM warning in the filesystem
freezing/thawing code. A new macro RWSEM_OWNER_UNKNOWN (-1) is exposed in
the linux/rwsem.h file to indicate that a rwsem is currently owned by an
unknown writer. Other than that, there is no externally visible changes.
The new RWSEM_OWNER_UNKNOWN macro has no dependency on internal rwsem
header. What is important is that bit 1 of the owner field is set which
is the marker used by the internal rwsem code to determine if the owner
is unknown or not.
The original code of clearing the owner field in percpu_rwsem_release()
isn't correct as a NULL owner field should correspond to an unlocked
rwsem which is not the case here. In addition, optimistic spinning
won't be stopped by a NULL owner value.
Testings are welcome.
Waiman Long (2):
locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag
locking/percpu-rwsem: Annotate rwsem ownership transfer by setting
RWSEM_OWNER_UNKNOWN
include/linux/percpu-rwsem.h | 6 +++++-
include/linux/rwsem.h | 6 ++++++
kernel/locking/rwsem-xadd.c | 19 +++++++++----------
kernel/locking/rwsem.c | 2 --
kernel/locking/rwsem.h | 30 +++++++++++++++++++++---------
5 files changed, 41 insertions(+), 22 deletions(-)
--
1.8.3.1
next reply other threads:[~2018-05-15 21:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 21:49 Waiman Long [this message]
2018-05-15 21:49 ` [PATCH v4 1/2] locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag Waiman Long
2018-05-16 10:48 ` Oleg Nesterov
2018-05-16 11:59 ` Peter Zijlstra
2018-05-16 13:11 ` Waiman Long
2018-05-16 15:27 ` Oleg Nesterov
2018-05-16 12:19 ` Matthew Wilcox
2018-05-18 7:02 ` Ingo Molnar
2018-05-18 8:41 ` Oleg Nesterov
2018-05-18 9:40 ` Ingo Molnar
2018-05-18 16:55 ` [PATCH] locking/rwsem: simplify the is-owner-spinnable checks Oleg Nesterov
2018-05-18 17:00 ` Waiman Long
2018-05-15 21:49 ` [PATCH v4 2/2] locking/percpu-rwsem: Annotate rwsem ownership transfer by setting RWSEM_OWNER_UNKNOWN Waiman Long
2018-05-16 5:37 ` Amir Goldstein
2018-05-16 13:17 ` 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=1526420991-21213-1-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 \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).