From: Lokesh Gidra <lokeshgidra@google.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Lokesh Gidra <lokeshgidra@google.com>,
Suren Baghdasaryan <surenb@google.com>,
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
Subject: Re: [PATCH v5 3/3] userfaultfd: use per-vma locks in userfaultfd operations
Date: Tue, 13 Feb 2024 11:55:11 -0800 [thread overview]
Message-ID: <CA+EESO5F7RB-_AwgxPV=9tCKx=E59sbaxvtc4q3u4sCL6PpcTg@mail.gmail.com> (raw)
In-Reply-To: <20240213195125.yhg5ti6qrchpela6@revolver>
On Tue, Feb 13, 2024 at 11:51 AM Liam R. Howlett
<Liam.Howlett@oracle.com> wrote:
>
> * Lokesh Gidra <lokeshgidra@google.com> [240213 14:37]:
> ...
>
> > Asking to avoid any more iterations: these functions should call the
> > currently defined ones or should replace them. For instance, should I
> > do the following:
> >
> > #ifdef CONFIG_PER_VMA_LOCK
> > ... uffd_mfill_lock()
> > {
> > return find_and_lock_dst_vma(...);
> > }
> > #else
> > ...uffd_mfill_lock()
> > {
> > return lock_mm_and_find_dst_vma(...);
> > }
> > #endif
> >
> > or have the function replace
> > find_and_lock_dst_vma()/lock_mm_and_find_dst_vma() ?
>
> Since the two have the same prototype, then you can replace the function
> names directly.
>
> The other side should take the vma and use vma->vm_mm to get the mm to
> unlock the mmap_lock in the !CONFIG_PER_VMA_LOCK. That way those
> prototypes also match and can use the same names directly.
>
> move_pages() requires unlocking two VMAs or one, so pass both VMAs
> through and do the check in there. This, unfortunately means that one
> of the VMAs will not be used in the !CONFIG_PER_VMA_LOCK case. You
> could add an assert to ensure src_vma is locked prior to using dst_vma
> to unlock the mmap_lock(), to avoid potential bot emails.
>
Perfect. Will do that and address the other comments you had on v5 as well.
Regarding int vs long for 'err' type, I'm assuming you are ok with my
explanation and I should keep long?
> Thanks,
> Liam
next prev parent reply other threads:[~2024-02-13 19:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 0:19 [PATCH v5 0/3] per-vma locks in userfaultfd Lokesh Gidra
2024-02-13 0:19 ` [PATCH v5 1/3] userfaultfd: move userfaultfd_ctx struct to header file Lokesh Gidra
2024-02-13 0:19 ` [PATCH v5 2/3] userfaultfd: protect mmap_changing with rw_sem in userfaulfd_ctx Lokesh Gidra
2024-02-13 0:19 ` [PATCH v5 3/3] userfaultfd: use per-vma locks in userfaultfd operations Lokesh Gidra
2024-02-13 3:33 ` Liam R. Howlett
2024-02-13 11:24 ` Lokesh Gidra
2024-02-13 17:06 ` Liam R. Howlett
2024-02-13 18:14 ` Lokesh Gidra
2024-02-13 18:25 ` Suren Baghdasaryan
2024-02-13 18:49 ` Liam R. Howlett
2024-02-13 18:56 ` Suren Baghdasaryan
2024-02-13 19:18 ` Lokesh Gidra
2024-02-13 19:27 ` Liam R. Howlett
2024-02-13 19:30 ` Suren Baghdasaryan
2024-02-13 19:36 ` Lokesh Gidra
2024-02-13 19:51 ` Liam R. Howlett
2024-02-13 19:55 ` Lokesh Gidra [this message]
2024-02-13 20:40 ` Liam R. Howlett
2024-02-13 19:21 ` Liam R. Howlett
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='CA+EESO5F7RB-_AwgxPV=9tCKx=E59sbaxvtc4q3u4sCL6PpcTg@mail.gmail.com' \
--to=lokeshgidra@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=ngeoffray@google.com \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=selinux@vger.kernel.org \
--cc=surenb@google.com \
--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