Re: [PATCH v3 06/10] mmap locking API: convert nested write lock sites

From: Peter Zijlstra
Date: Wed Apr 01 2020 - 09:42:49 EST


On Fri, Mar 27, 2020 at 03:50:58PM -0700, Michel Lespinasse wrote:

> @@ -26,6 +31,12 @@ static inline void mmap_write_unlock(struct mm_struct *mm)
> up_write(&mm->mmap_sem);
> }
>
> +/* Pairs with mmap_write_lock_nested() */
> +static inline void mmap_write_unlock_nested(struct mm_struct *mm)
> +{
> + up_write(&mm->mmap_sem);
> +}
> +
> static inline void mmap_downgrade_write_lock(struct mm_struct *mm)
> {
> downgrade_write(&mm->mmap_sem);

Why does unlock_nested() make sense ?