From: Suren Baghdasaryan <surenb@google.com>
To: Lokesh Gidra <lokeshgidra@google.com>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
selinux@vger.kernel.org, kernel-team@android.com,
aarcange@redhat.com, peterx@redhat.com, david@redhat.com,
axelrasmussen@google.com, bgeffon@google.com,
willy@infradead.org, jannh@google.com, kaleshsingh@google.com,
ngeoffray@google.com, timmurray@google.com, rppt@kernel.org,
Liam.Howlett@oracle.com, ryan.roberts@arm.com
Subject: Re: [PATCH v7 3/4] mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK
Date: Thu, 15 Feb 2024 14:19:41 -0800 [thread overview]
Message-ID: <CAJuCfpFe2spt082fdB99ow+pqGj+DKnep6cHxoVYRVYgyO9uhg@mail.gmail.com> (raw)
In-Reply-To: <20240215182756.3448972-4-lokeshgidra@google.com>
On Thu, Feb 15, 2024 at 10:28 AM Lokesh Gidra <lokeshgidra@google.com> wrote:
>
> vma_assert_locked() is needed to replace mmap_assert_locked() once we
> start using per-vma locks in userfaultfd operations.
>
> In !CONFIG_PER_VMA_LOCK case when mm is locked, it implies that the
> given VMA is locked.
Yes, makes sense. With per-vma locks used in more places, this makes
replacing mmap_assert_locked() with vma_assert_locked() very
straight-forward.
>
> Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
> ---
> include/linux/mm.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 3c85634b186c..5ece3ad34ef8 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -781,6 +781,11 @@ static inline struct vm_area_struct *lock_vma_under_rcu(struct mm_struct *mm,
> return NULL;
> }
>
> +static inline void vma_assert_locked(struct vm_area_struct *vma)
> +{
> + mmap_assert_locked(vma->vm_mm);
> +}
> +
> static inline void release_fault_lock(struct vm_fault *vmf)
> {
> mmap_read_unlock(vmf->vma->vm_mm);
> --
> 2.43.0.687.g38aa6559b0-goog
>
next prev parent reply other threads:[~2024-02-15 22:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 18:27 [PATCH v7 0/4] per-vma locks in userfaultfd Lokesh Gidra
2024-02-15 18:27 ` [PATCH v7 1/4] userfaultfd: move userfaultfd_ctx struct to header file Lokesh Gidra
2024-02-15 18:27 ` [PATCH v7 2/4] userfaultfd: protect mmap_changing with rw_sem in userfaulfd_ctx Lokesh Gidra
2024-02-15 18:27 ` [PATCH v7 3/4] mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK Lokesh Gidra
2024-02-15 22:19 ` Suren Baghdasaryan [this message]
2024-02-15 18:27 ` [PATCH v7 4/4] userfaultfd: use per-vma locks in userfaultfd operations Lokesh Gidra
2025-01-23 4:14 ` Barry Song
2025-01-23 16:48 ` Lorenzo Stoakes
2025-01-23 17:07 ` Lorenzo Stoakes
2025-01-23 17:14 ` David Hildenbrand
2025-01-23 17:46 ` Suren Baghdasaryan
2025-01-23 16:52 ` Liam R. Howlett
2025-01-23 18:45 ` Lokesh Gidra
2025-01-27 22:08 ` Barry Song
2025-01-23 17:14 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJuCfpFe2spt082fdB99ow+pqGj+DKnep6cHxoVYRVYgyO9uhg@mail.gmail.com \
--to=surenb@google.com \
--cc=Liam.Howlett@oracle.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=bgeffon@google.com \
--cc=david@redhat.com \
--cc=jannh@google.com \
--cc=kaleshsingh@google.com \
--cc=kernel-team@android.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lokeshgidra@google.com \
--cc=ngeoffray@google.com \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=selinux@vger.kernel.org \
--cc=timmurray@google.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox