Re: [PATCH v5 10/10] mmap locking API: rename mmap_sem to mmap_lock
From: Matthew Wilcox
Date: Wed Apr 22 2020 - 21:59:27 EST
On Wed, Apr 22, 2020 at 03:54:32PM -0700, Michel Lespinasse wrote:
> On Tue, Apr 21, 2020 at 6:58 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> >
> > On Tue, Apr 21, 2020 at 05:14:22PM -0700, Michel Lespinasse wrote:
> > > Rename the mmap_sem field to mmap_lock. Any new uses of this lock
> >
> > Shouldn't some of these be folded into the previous patch?
>
> So, I didn't do it because previous patch only handled rwsem_is_locked
> call sites. I leaned towards adding as few new API functions as
> possible until we figure out exactly what is required.
>
> That said, I agree it seems reasonable to split mmap_assert_locked()
> into mmap_assert_read_locked() and mmap_assert_write_locked(), and
> convert the lockdep asserts to use these instead.
Just add mmap_assert_write_locked() -- some of these places can be called
with the rwsem held for either read or write; it doesn't matter which.
Others need it held for write. There aren't any places (that I'm aware
of) that need to assert that it's held for read, and not held for write.
> I'm not sure we need to do it right away though; we are at least not
> losing any test coverage with the existing version of the patchset...
It seems like a better way to remove users of the term 'mmap_sem' than
just converting them to use the new 'mmap_lock'.