Re: [PATCH v4 01/10] mmap locking API: initial implementation as rwsem wrappers

From: Michel Lespinasse
Date: Mon Apr 20 2020 - 20:48:36 EST


On Mon, Apr 20, 2020 at 12:51 PM Davidlohr Bueso <dave@xxxxxxxxxxxx> wrote:
> With one observation below.
>
> >+static inline void mmap_downgrade_write_lock(struct mm_struct *mm)
> >+{
> >+ downgrade_write(&mm->mmap_sem);
> >+}
>
> Shouldn't this really be just mmap_downgrade_write()? In locking
> normally don't add the _lock at the end as it implies the operation
> of acquiring the lock.

Hmmm, I see your point. Actually here the operation is downgrade, so
arguably the name should be mmap_write_downgrade ? I'm not sure I like
the name though, as it does not make it entirely obvious that the
function is a locking primitive.

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