Re: [PATCH v4 08/10] mmap locking API: add MMAP_LOCK_INITIALIZER

From: Michel Lespinasse
Date: Mon Apr 20 2020 - 20:57:33 EST


On Mon, Apr 20, 2020 at 12:28 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Tue, Apr 14, 2020 at 05:43:51PM -0700, Michel Lespinasse wrote:
> > @@ -90,7 +90,7 @@ static struct mm_struct tboot_mm = {
> ^^^^^^^^
> > .pgd = swapper_pg_dir,
> > .mm_users = ATOMIC_INIT(2),
> > .mm_count = ATOMIC_INIT(1),
> > - .mmap_sem = __RWSEM_INITIALIZER(init_mm.mmap_sem),
> > + .mmap_sem = MMAP_LOCK_INITIALIZER(init_mm.mmap_sem),
> ^^^^^^^
>
> Shome mishtake, shirley?
>
> I don't see that this particular patch buys us much. The name 'mmap_sem'
> is still used, and I appreciate we abstract away the type of the lock,
> but wouldn't this be better?
>
> - .mmap_sem = __RWSEM_INITIALIZER(init_mm.mmap_sem),
> + MMAP_LOCK_INITIALIZER(tboot_mm),

Hmmm, that's significantly different from other initializers we have,
which may be a downside ? But other than that, it does seem completely
workable to me. Do you have a strong preference ?

--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.