Commit 626e98cb authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Andrew Morton

mm: make MEMFD_CREATE into a selectable config option

The memfd_create() syscall, enabled by CONFIG_MEMFD_CREATE, is useful on
its own even when not required by CONFIG_TMPFS or CONFIG_HUGETLBFS.

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.

Link: https://lkml.kernel.org/r/20230630-config-memfd-v1-1-9acc3ae38b5a@weissschuh.netSigned-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Tested-by: default avatarZhangjin Wu <falcon@tinylab.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent fc1878ec
...@@ -169,6 +169,7 @@ source "fs/sysfs/Kconfig" ...@@ -169,6 +169,7 @@ source "fs/sysfs/Kconfig"
config TMPFS config TMPFS
bool "Tmpfs virtual memory file system support (former shm fs)" bool "Tmpfs virtual memory file system support (former shm fs)"
depends on SHMEM depends on SHMEM
select MEMFD_CREATE
help help
Tmpfs is a file system which keeps all files in virtual memory. Tmpfs is a file system which keeps all files in virtual memory.
...@@ -240,6 +241,7 @@ config HUGETLBFS ...@@ -240,6 +241,7 @@ config HUGETLBFS
bool "HugeTLB file system support" bool "HugeTLB file system support"
depends on X86 || IA64 || SPARC64 || ARCH_SUPPORTS_HUGETLBFS || BROKEN depends on X86 || IA64 || SPARC64 || ARCH_SUPPORTS_HUGETLBFS || BROKEN
depends on (SYSFS || SYSCTL) depends on (SYSFS || SYSCTL)
select MEMFD_CREATE
help help
hugetlbfs is a filesystem backing for HugeTLB pages, based on hugetlbfs is a filesystem backing for HugeTLB pages, based on
ramfs. For architectures that support it, say Y here and read ramfs. For architectures that support it, say Y here and read
...@@ -264,9 +266,6 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON ...@@ -264,9 +266,6 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON
enable HVO by default. It can be disabled via hugetlb_free_vmemmap=off enable HVO by default. It can be disabled via hugetlb_free_vmemmap=off
(boot command line) or hugetlb_optimize_vmemmap (sysctl). (boot command line) or hugetlb_optimize_vmemmap (sysctl).
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
config ARCH_HAS_GIGANTIC_PAGE config ARCH_HAS_GIGANTIC_PAGE
bool bool
......
...@@ -1144,6 +1144,9 @@ config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY ...@@ -1144,6 +1144,9 @@ config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
config IO_MAPPING config IO_MAPPING
bool bool
config MEMFD_CREATE
bool "Enable memfd_create() system call" if EXPERT
config SECRETMEM config SECRETMEM
default y default y
bool "Enable memfd_secret() system call" if EXPERT bool "Enable memfd_secret() system call" if EXPERT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment