[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200401134633.GS20696@hirez.programming.kicks-ass.net>
Date: Wed, 1 Apr 2020 15:46:33 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Michel Lespinasse <walken@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Laurent Dufour <ldufour@...ux.ibm.com>,
Vlastimil Babka <vbabka@...e.cz>,
Matthew Wilcox <willy@...radead.org>,
Liam Howlett <Liam.Howlett@...cle.com>,
Jerome Glisse <jglisse@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>,
David Rientjes <rientjes@...gle.com>,
Hugh Dickins <hughd@...gle.com>, Ying Han <yinghan@...gle.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Markus Elfring <Markus.Elfring@....de>
Subject: Re: [PATCH v3 07/10] mmap locking API: add mmap_read_release() and
mmap_read_unlock_non_owner()
On Fri, Mar 27, 2020 at 03:50:59PM -0700, Michel Lespinasse wrote:
> Add a couple APIs to allow splitting mmap_read_unlock() into two calls:
> - mmap_read_release(), called by the task that had taken the mmap lock;
> - mmap_read_unlock_non_owner(), called from a work queue.
>
> These apis are used by kernel/bpf/stackmap.c only.
That code is an absolute abomination and should never have gotten
merged.
That said; I would prefer a mmap_read_trylock_nonowner() over
mmap_read_release() existing.
> Signed-off-by: Michel Lespinasse <walken@...gle.com>
> ---
> include/linux/mmap_lock.h | 10 ++++++++++
> kernel/bpf/stackmap.c | 9 ++++-----
> 2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
> index 36fb758401d6..a80cf9695514 100644
> --- a/include/linux/mmap_lock.h
> +++ b/include/linux/mmap_lock.h
> @@ -62,4 +62,14 @@ static inline void mmap_read_unlock(struct mm_struct *mm)
> up_read(&mm->mmap_sem);
> }
>
> +static inline void mmap_read_release(struct mm_struct *mm, unsigned long ip)
> +{
> + rwsem_release(&mm->mmap_sem.dep_map, ip);
> +}
> +
> +static inline void mmap_read_unlock_non_owner(struct mm_struct *mm)
> +{
> + up_read_non_owner(&mm->mmap_sem);
> +}
> +
> #endif /* _LINUX_MMAP_LOCK_H */
Powered by blists - more mailing lists