From patchwork Fri Jun 30 09:08:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13297836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA1B0EB64D7 for ; Fri, 30 Jun 2023 09:09:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B8D58D0006; Fri, 30 Jun 2023 05:09:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 468FA8D0001; Fri, 30 Jun 2023 05:09:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37EC98D0006; Fri, 30 Jun 2023 05:09:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 298DD8D0001 for ; Fri, 30 Jun 2023 05:09:04 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E63D9120E79 for ; Fri, 30 Jun 2023 09:09:03 +0000 (UTC) X-FDA: 80958839766.07.8066C66 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by imf15.hostedemail.com (Postfix) with ESMTP id 91DBBA0017 for ; Fri, 30 Jun 2023 09:09:01 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=weissschuh.net header.s=mail header.b=nAHp3GNW; dmarc=none; spf=pass (imf15.hostedemail.com: domain of linux@weissschuh.net designates 159.69.126.157 as permitted sender) smtp.mailfrom=linux@weissschuh.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688116142; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=vtT/XJToroaRvD1p4AP+5GbgoCpzejb0QSvFvOoAOaI=; b=F0b53tGsBupGPA3UuU3oE8kOqCb8FSVik7RA4HAISUbxwYdlsqEv0OnFE7urAe5AhH90L7 ZpZ6olahCOgbYNPNyKZxcvZeWXcrX76JmVZ0kKu49J4HqK3tLawYqcG2cJzHxuPR7034ek JEG49hjJnCdGgGPIQns1jQMHmbC3h70= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=weissschuh.net header.s=mail header.b=nAHp3GNW; dmarc=none; spf=pass (imf15.hostedemail.com: domain of linux@weissschuh.net designates 159.69.126.157 as permitted sender) smtp.mailfrom=linux@weissschuh.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688116142; a=rsa-sha256; cv=none; b=EasySUAuhpvdydQkcCd63C6uuPJpv0uQW3lMoXLL547Sk5XxQGNmb8oA0920X0i77W6jvu ubDf0RAlaKe2CGkbYDFr8pPRv/kKNcK8BAHM+R6LLlbbqzdk+TUTWJeHGszdxtRm/rBztg LxWJ7SqPWwLpZUXJ7nd30XV5MA6UD5s= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1688116139; bh=OOAKwOFfZgl3msnuVjn16jsWxbjqhfuBBnZpLziJnjI=; h=From:Date:Subject:To:Cc:From; b=nAHp3GNWH3bIQbbJ7B2nTlLTXY9Xq9hWNzqd0TfTgHy3IlpLDeWD+dqQm7O/eXYKH 0K/WErRYqTmvh7xyi3fti32K8jO6hhbiSopGvMb1wcI5VLDlClgpI9DBF50J9KHfdA jEofzwLiPn0IJVU1BBMtLuj1xR1dkREs+FIaJFUk= Date: Fri, 30 Jun 2023 11:08:53 +0200 Subject: [PATCH] mm: make MEMFD_CREATE into a selectable config option MIME-Version: 1.0 Message-Id: <20230630-config-memfd-v1-1-9acc3ae38b5a@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAKSbnmQC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2MDMyNL3eT8vLTMdN3c1Ny0FN2kVLPENAPjJPOU5EQloJaCotS0zAqwcdG xtbUA9l1O0V4AAAA= To: Alexander Viro , Christian Brauner , Andrew Morton Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Willy Tarreau , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1688116137; l=2138; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=OOAKwOFfZgl3msnuVjn16jsWxbjqhfuBBnZpLziJnjI=; b=kQBkkRFrqk5TKAAbU2s4iVjeJ2yAWu+HDlzAGyCqAqXUgKoaMED26dyk7Wz3UwkSiKAieqaCN wukedK6JuBXC9N+wJRWyCzBe5NaSB5lv8wz20O/k+hugFZlrp9EiaeA X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Rspamd-Queue-Id: 91DBBA0017 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: mc9mb8zs8j4syuggth5d7rg6fb8xexcz X-HE-Tag: 1688116141-842360 X-HE-Meta: U2FsdGVkX19N5pfoyrwfkPMdd8XoP4ZcSiQY3hRdIvHNb3Y1ts/ocJ2FYCNCLkavR2vGZsA1WaP4FGdjp9wQSmv+1vbjnrWEI/dwIwIgkgws6NW0ah77WJcOROcpxLXFw0x5loaH8wLp9lNR2x+asR9CEpbAnLjPtHY6hV0QHzeUD9r3G/RTTG4PlW+nj2mlsVc3dqLPbHtn0ppaDSMJpW+YMMEi8/kNBVUE2cIGNnR8Mq4TV2BQAC8ZYTyvOVGDg/xOmgbgipDO+cdc+wpe9S6DKadLmETycP+M1VDHIROayvGRum8+ctQXogp01z7Yc5X+tiGrlrzWvhrwjFEX68pIENarlPQGwWBqz76E0dKHor+7dglgJP5nnRZReskq+ZIYgb9z7/xPm+JomTvp8M8DEgc+aahB9DHEEdQcepVow51LuYXGWwx5Vpk1qxv84qIbPlJpr5N2jMZ7VmEYu4yFv1v9y7TNa0YofpFBeExt7Q4yEfVevL3chMEKjmIFYV68ytzV7lQVYCO+rmo9Eif9WaBGLxGUgBqBDPnCN1QUPxozsENJB0tgMvtojimWvTJzjDPijOeqdZHNxIKOghDXeMf2b60lxYlDHbd4vR/XSQbF34oAuiJIZuwn1T6MnOvUdZ4PhzUfZaBetW3ydi+EPjY3vS/Jkib10885D2LcA8gnYZzLeCgrXQIsk9vgUbozv1vYWePPgrgp2TWkUmBw6q5rMiCgicWtq7Nv7m1GNOuEScYq677zatGIsvJRATCh+MFakg53AUPUNscHcv1hZw14/abBDo0ov98bObMevJw5zd5VjY2HDJHJRI8o0czzs8k+wPO3OBcOlbLU0iFOmupMDVnrFKaVGdzNzXUwPx+stVZJseQKgiT7bU1ZTnJLf5e2+tdb7WYboSgYRp9MSBnp1XrHYISSZq43ChTqNlqhrUw9LMniSkHWAAtTi652ac2Yegqf+7ddQxR QGsI0JxF 77uom23VCeHLNCWBP5PV4OCV38iRg55giiBTqj03g4J6gPqfYlzucuZyp+2cjk5Ba2DjRema0POFdoNVeRM1TyIQQgDr+VCf6orA1FLFqa8uXi3AT9xQ+37GRx2FRJjmjY+sIO3DLWZqTS3Cbtiam++O6Ibf7tBZ0xfS1dCVvFmVyWuU+g+BXU44ZIg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Tested-by: Zhangjin Wu --- fs/Kconfig | 5 ++--- mm/Kconfig | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) --- base-commit: e55e5df193d247a38a5e1ac65a5316a0adcc22fa change-id: 20230629-config-memfd-be6af03b7dca Best regards, 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