Re: [PATCH v8 22/23] mm: Enable PTE markers by default

From: Peter Xu
Date: Tue Apr 19 2022 - 16:28:26 EST


On Tue, Apr 19, 2022 at 04:14:11PM -0400, Johannes Weiner wrote:
> Hi Peter,
>
> On Tue, Apr 19, 2022 at 03:59:21PM -0400, Peter Xu wrote:
> > @@ -910,16 +910,16 @@ config ANON_VMA_NAME
> > difference in their name.
> >
> > config PTE_MARKER
> > - bool "Marker PTEs support"
> > - default y
> > + bool
> >
> > help
> > Allows to create marker PTEs for file-backed memory.
> >
> > config PTE_MARKER_UFFD_WP
> > - bool "Marker PTEs support for userfaultfd write protection"
> > + bool "Userfaultfd write protection support for shmem/hugetlbfs"
> > default y
> > - depends on PTE_MARKER && HAVE_ARCH_USERFAULTFD_WP
> > + depends on HAVE_ARCH_USERFAULTFD_WP
> > + select PTE_MARKER
>
> This is much easier to understand, thanks!

Cool! Sent as a formal patch just now.

>
> Btw, this doesn't do much without userfaultfd being enabled in
> general, right?

So far yes, but I'm thinking there can be potential other users of
PTE_MARKERS from mm world. The most close discussion is on the swap read
failures and this patch proposed by Miaohe:

https://lore.kernel.org/lkml/20220416030549.60559-1-linmiaohe@xxxxxxxxxx/

So I hope we can still keep them around here under mm/ if possible, and
from the gut feeling it really should..

> Would it make sense to have it next to 'config USERFAULTFD' as a
> sub-option?

Yes another good question. :)

IIUC CONFIG_USERFAULTFD resides in init/Kconfig because it introduces a new
syscall. Same to the rest of the bits for uffd since then, namely:

- USERFAULTFD_WP
- USERFAULTFD_MINOR

What I am thinking now is the other way round of your suggestion: whether
we should move most of them out, at least the _WP and _MINOR configs into
mm/? Because IMHO they are really pure mm ideas and they're irrelevant to
syscalls and init.

Any thoughts?

--
Peter Xu