linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	 Christian Brauner <brauner@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, "Willy Tarreau" <w@lwt.eu>,
	"Zhangjin Wu" <falcon@tinylab.org>,
	"Thomas Weißschuh" <linux@weissschuh.net>
Subject: [PATCH] mm: make MEMFD_CREATE into a selectable config option
Date: Fri, 30 Jun 2023 11:08:53 +0200	[thread overview]
Message-ID: <20230630-config-memfd-v1-1-9acc3ae38b5a@weissschuh.net> (raw)

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.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 fs/Kconfig | 5 ++---
 mm/Kconfig | 3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/Kconfig b/fs/Kconfig
index 18d034ec7953..19975b104bc3 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -169,6 +169,7 @@ source "fs/sysfs/Kconfig"
 config TMPFS
 	bool "Tmpfs virtual memory file system support (former shm fs)"
 	depends on SHMEM
+	select MEMFD_CREATE
 	help
 	  Tmpfs is a file system which keeps all files in virtual memory.
 
@@ -240,6 +241,7 @@ config HUGETLBFS
 	bool "HugeTLB file system support"
 	depends on X86 || IA64 || SPARC64 || ARCH_SUPPORTS_HUGETLBFS || BROKEN
 	depends on (SYSFS || SYSCTL)
+	select MEMFD_CREATE
 	help
 	  hugetlbfs is a filesystem backing for HugeTLB pages, based on
 	  ramfs. For architectures that support it, say Y here and read
@@ -264,9 +266,6 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON
 	  enable HVO by default. It can be disabled via hugetlb_free_vmemmap=off
 	  (boot command line) or hugetlb_optimize_vmemmap (sysctl).
 
-config MEMFD_CREATE
-	def_bool TMPFS || HUGETLBFS
-
 config ARCH_HAS_GIGANTIC_PAGE
 	bool
 
diff --git a/mm/Kconfig b/mm/Kconfig
index 09130434e30d..22acffd9009d 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1144,6 +1144,9 @@ config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
 config IO_MAPPING
 	bool
 
+config MEMFD_CREATE
+	bool "Enable memfd_create() system call" if EXPERT
+
 config SECRETMEM
 	default y
 	bool "Enable memfd_secret() system call" if EXPERT

---
base-commit: e55e5df193d247a38a5e1ac65a5316a0adcc22fa
change-id: 20230629-config-memfd-be6af03b7dca

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>



             reply	other threads:[~2023-06-30  9:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  9:08 Thomas Weißschuh [this message]
2023-06-30 13:38 ` [PATCH] mm: make MEMFD_CREATE into a selectable config option Zhangjin Wu
2023-06-30 15:32 ` Darrick J. Wong
2023-06-30 19:55   ` Thomas Weißschuh
2023-07-03 22:48   ` Mike Kravetz

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=20230630-config-memfd-v1-1-9acc3ae38b5a@weissschuh.net \
    --to=linux@weissschuh.net \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=falcon@tinylab.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=w@lwt.eu \
    /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;
as well as URLs for NNTP newsgroup(s).