Re: [PATCH] mm: make MEMFD_CREATE into a selectable config option

From: Thomas Weißschuh
Date: Fri Jun 30 2023 - 15:56:02 EST


On 2023-06-30 08:32:36-0700, Darrick J. Wong wrote:
> On Fri, Jun 30, 2023 at 11:08:53AM +0200, Thomas Weißschuh wrote:
> > The memfd_create() syscall, enabled by CONFIG_MEMFD_CREATE, is useful on
> > its own even when not required by CONFIG_TMPFS or CONFIG_HUGETLBFS.
>
> If you don't have tmpfs or hugetlbfs enabled, then what fs ends up
> backing the file returned by memfd_create()? ramfs?

ramfs, correct.

It goes via mm/memfd.c -> mm/shmem.c -> fs/ramfs/ .

Thomas

> (Not an objection, I'm just curious...)
>
> --D
>
> > Split it into its own proper bool option that can be enabled by users.
> >
> > Move that option into mm/ where the code itself also lies.
> > Also add "select" statements to CONFIG_TMPFS and CONFIG_HUGETLBFS so
> > they automatically enable CONFIG_MEMFD_CREATE as before.
> >
> > Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> > ---
> > fs/Kconfig | 5 ++---
> > mm/Kconfig | 3 +++
> > 2 files changed, 5 insertions(+), 3 deletions(-)

> [..]