From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Chandan Babu R <chandan.babu@oracle.com>,
"Darrick J . Wong" <djwong@kernel.org>,
linux-xfs@vger.kernel.org, Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH v2 0/5] Remove the XFS mrlock
Date: Sat, 7 Oct 2023 21:35:38 +0100 [thread overview]
Message-ID: <20231007203543.1377452-1-willy@infradead.org> (raw)
XFS has an mrlock wrapper around the rwsem which adds only the
functionality of knowing whether the rwsem is currently held in read
or write mode. Both regular rwsems and rt-rwsems know this, they just
don't expose it as an API. By adding that, we can remove the XFS mrlock
as well as improving the debug assertions for the mmap_lock when lockdep
is disabled.
v2: Add rwsem_assert_held() and rwsem_assert_held_write() instead of
augmenting the existing rwsem_is_locked() with rwsem_is_write_locked().
There's also an __rwsem_assert_held() and __rwsem_assert_held_write()
for the benefit of XFS when it's in a context where lockdep doesn't
know what's going on. It's still an improvement, so I hope those who
are looking for perfection can accept a mere improvement.
We can do more to replace uses of rwsem_is_locked(), and I have a few of
those in my tree, but let's focus on these three use cases for now and
we can trickle in other improvements through other maintainers after 6.7.
I'm sympathetic to "this will warn twice and dump much the same
information if you have lockdep enabled". Perhaps somebody has a
suggestion for not doing that?
Matthew Wilcox (Oracle) (5):
locking: Add rwsem_assert_held() and rwsem_assert_held_write()
mm: Use rwsem assertion macros for mmap_lock
xfs: Replace xfs_isilocked with xfs_assert_locked
xfs: Remove mrlock wrapper
fs: Add inode_assert_locked() and inode_assert_locked_excl()
fs/attr.c | 2 +-
fs/namei.c | 6 +--
fs/xfs/libxfs/xfs_attr.c | 2 +-
fs/xfs/libxfs/xfs_attr_remote.c | 2 +-
fs/xfs/libxfs/xfs_bmap.c | 19 ++++----
fs/xfs/libxfs/xfs_defer.c | 2 +-
fs/xfs/libxfs/xfs_inode_fork.c | 2 +-
fs/xfs/libxfs/xfs_rtbitmap.c | 2 +-
fs/xfs/libxfs/xfs_trans_inode.c | 6 +--
fs/xfs/mrlock.h | 78 ------------------------------
fs/xfs/scrub/readdir.c | 4 +-
fs/xfs/xfs_attr_list.c | 2 +-
fs/xfs/xfs_bmap_util.c | 10 ++--
fs/xfs/xfs_dir2_readdir.c | 2 +-
fs/xfs/xfs_dquot.c | 4 +-
fs/xfs/xfs_file.c | 4 +-
fs/xfs/xfs_inode.c | 86 ++++++++++++---------------------
fs/xfs/xfs_inode.h | 4 +-
fs/xfs/xfs_inode_item.c | 4 +-
fs/xfs/xfs_iops.c | 7 ++-
fs/xfs/xfs_linux.h | 2 +-
fs/xfs/xfs_qm.c | 10 ++--
fs/xfs/xfs_reflink.c | 2 +-
fs/xfs/xfs_rtalloc.c | 4 +-
fs/xfs/xfs_super.c | 4 +-
fs/xfs/xfs_symlink.c | 2 +-
fs/xfs/xfs_trans_dquot.c | 2 +-
include/linux/fs.h | 10 ++++
include/linux/mmap_lock.h | 10 ++--
include/linux/rwbase_rt.h | 9 +++-
include/linux/rwsem.h | 42 ++++++++++++++--
31 files changed, 142 insertions(+), 203 deletions(-)
delete mode 100644 fs/xfs/mrlock.h
--
2.40.1
next reply other threads:[~2023-10-07 20:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-07 20:35 Matthew Wilcox (Oracle) [this message]
2023-10-07 20:35 ` [PATCH v2 1/5] locking: Add rwsem_assert_held() and rwsem_assert_held_write() Matthew Wilcox (Oracle)
2023-10-08 21:54 ` Dave Chinner
2023-10-07 20:35 ` [PATCH v2 2/5] mm: Use rwsem assertion macros for mmap_lock Matthew Wilcox (Oracle)
2023-10-07 20:35 ` [PATCH v2 3/5] xfs: Replace xfs_isilocked with xfs_assert_locked Matthew Wilcox (Oracle)
2023-10-08 21:59 ` Dave Chinner
2023-10-09 18:27 ` Darrick J. Wong
2023-10-07 20:35 ` [PATCH v2 4/5] xfs: Remove mrlock wrapper Matthew Wilcox (Oracle)
2023-10-08 22:17 ` Dave Chinner
2023-10-07 20:35 ` [PATCH v2 5/5] fs: Add inode_assert_locked() and inode_assert_locked_excl() Matthew Wilcox (Oracle)
2023-10-08 20:26 ` Mateusz Guzik
2023-10-08 21:05 ` Matthew Wilcox
2023-10-08 21:21 ` Mateusz Guzik
2023-10-08 20:31 ` [PATCH v2 0/5] Remove the XFS mrlock Mateusz Guzik
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=20231007203543.1377452-1-willy@infradead.org \
--to=willy@infradead.org \
--cc=chandan.babu@oracle.com \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=mjguzik@gmail.com \
--cc=peterz@infradead.org \
--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