From patchwork Sat Jan 11 07:07:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaixiong Yu X-Patchwork-Id: 13935831 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 5419BE7719A for ; Sat, 11 Jan 2025 07:12:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A57B56B0092; Sat, 11 Jan 2025 02:12:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A06726B0093; Sat, 11 Jan 2025 02:12:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CE126B0095; Sat, 11 Jan 2025 02:12:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 706E36B0092 for ; Sat, 11 Jan 2025 02:12:25 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D2F0EC10EA for ; Sat, 11 Jan 2025 07:12:24 +0000 (UTC) X-FDA: 82994302608.19.36FE285 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf17.hostedemail.com (Postfix) with ESMTP id 649F740015 for ; Sat, 11 Jan 2025 07:12:21 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736579543; a=rsa-sha256; cv=none; b=C2tASX3/m/v1VWASz7/KzxlxWQkQzUnMyxhH96yOhytW4autM/uWxw+U08BAFU1LbhjhwA 44mV+ya/IGdBP3E6phJ4xqbRtRG7ObUf+B96Mxt3h9L3mE7sPAp2NLqorJ7mhMwlVrELgM mXyVFYme5nz5WKpMKsNtcXbgnNQdeV0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736579543; 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; bh=cgMOYGlnB78h5ZxmEZH6qKiG+VsUXZHGAsbrXh01Dgs=; b=vq71gnL0pFLBlQHY/myVkttE7Tpy7k7OcNsXfMh3/nIecCoOeJPDUILlWPW+lWf1R6LPOn dliHsgRF+dULcTROBUt35WIQ6C6sWd6ft5baXLA1I55IRyMqjWqU4CT+XcVO/JcPCAWwCR 3Dm5ZhqXHvIYp6WmWM0JfqEHqwmDqdM= Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4YVV4m2cHRz1ky3H; Sat, 11 Jan 2025 15:09:12 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 331121A016C; Sat, 11 Jan 2025 15:12:17 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 11 Jan 2025 15:12:13 +0800 From: Kaixiong Yu To: , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 -next 00/16] sysctl: move sysctls from vm_table into its own files Date: Sat, 11 Jan 2025 15:07:35 +0800 Message-ID: <20250111070751.2588654-1-yukaixiong@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 649F740015 X-Stat-Signature: txm15rajgk5xu5jwx9a4me4tnc3szsjb X-HE-Tag: 1736579541-160265 X-HE-Meta: U2FsdGVkX19rTfMEEXhAUix3Sp9glbqICclA3WtMImc1qtIWpoR5Tc4mONoMa1JsHwFE6AOkq4zliIWjv7PBtoaiSQ5ShnqjeO0T6l5ZMagCuqqnRzk7TEIPmOV97DqoTNFr0jw1deN2xWmUXhqvS3ECzavoAz4zuA6g20p4pp8OnORhB4Mh+v8oaGjK6JkJYc/HsxhQxhqxHmwPazT+lpRNfYxIH/u8Z/WHeHbeteNiz+UJRhc3vCAbfcD/JpDksAQkpiKI24zEezaKmwdbuT5YP3WuE09r/fX5K6OZ2l4ciYXVG7HvMgRetDHLH7bv9pz5hEwq8ajRy4HbadVJledXPkpKyVKTNfIUDuQaleeQOgFicbVhkLUc8Onz7+RG6Ky0Zu+1EKqr5u0q3Z4Pl1+qnTToVYQ+j3Y+cYQ71XsTs/u5YdPH6SV7d1B4esvUSFboblmP5FTMQp2c3sOdhWKQDOlF+DLQrTWxYMnEZqYX7vQFhE0SlpYOABxWI9M/oiP6+QTz6QI+9niEYc5HjpuZsx+qFmUd8udA5L0QXUKrawqnweB/gArHNDadCGzM/kJEdS0D8509Lj/rshf0istxIrsmnA/6e1cm4XM2++KTV2CGTt52aOPolTVTnVDoOkA6GurcOxUMr2svFoWykaFTf5gtzPJErTcPmHBQeHCC1amXGk2FvN2S5iO4hat7UyKeDBtw5ixCkm1Nl2BF4UnWSzRQLePzOWdxfv0OD8hmEffgAFVPE3MkgH1SZDzCx0E+3HfBgvNCywdgK91Tq++RUAFVtdUNHtnRXCec0udhltMZNkRMg1PCicjianmIHWtlgtrFjqsfwTTPGJaTwfy07bIOMESkgnZSlNMfEAWsSOH2oo82RAy16kkmqTOqHotFqW8q2BsCkuw39fExN4LZdXrz0usrLvQLlZ7PTgXeiM8yJbe5mi8ka/1cGgsDQQ1HfEd6Ojyvi+FVvc8 ugugpF+3 M5YRmpfJ48hbBQy65eApsHAWhjRqJTtTMZGCyktae2wUooq56mj31wvux4uMHTadFla0lliDXnAAlXcF6qKrCTgQk8c71aKeHo/KZNGm2PhhCGfRJyY518U4fJTeP2J1tlSesf+R1duk1dbmiisSkAIe8Po0pK7b/6asL 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: List-Subscribe: List-Unsubscribe: This patch series moves sysctls of vm_table in kernel/sysctl.c to places where they actually belong, and do some related code clean-ups. After this patch series, all sysctls in vm_table have been moved into its own files, meanwhile, delete vm_table. All the modifications of this patch series base on linux-next(tags/next-20250110). To test this patch series, the code was compiled with both the CONFIG_SYSCTL enabled and disabled on arm64 and x86_64 architectures. After this patch series is applied, all files under /proc/sys/vm can be read or written normally. my test steps as below listed: Step 1: Set CONFIG_SYSCTL to 'n' and compile the Linux kernel on the arm64 architecture. The kernel compiles successfully without any errors or warnings. Step 2: Set CONFIG_SYSCTL to 'y' and compile the Linux kernel on the arm64 architecture. The kernel compiles successfully without any errors or warnings. Step 3: Use QEMU to boot the kernel compiled in Step 2, then use the Linux command |ls -ll /proc/sys/vm/| to check the permissions of all sysctls under the |/proc/sys/vm| directory. When compared with the kernel version that did not apply this series of patches, there is no difference in the sysctl permissions under the |/proc/sys/vm| directory between the two kernel versions. Step 4: Repeat steps 1 to 3 on the x86_64 architecture. Changes in v5: - add reviewed-by from Lorenzo Stoakes in patch6,8 - Accept Brian Gerst's suggestion to reduce the preprocessor condition "#elif (defined(CONFIG_X86_32) && !defined(CONFIG_UML))" in patch13 - fix the error discovered by Geert Uytterhoeven in patch14 in V4. Move the call to register_sysctl_init() into its own fs_initcall() as Geert Uytterhoeven's patch does. - take the advice of Joel Granados, separating patch14 in V4 into patch14 and patch15 in V5. patch14 in V5 just moves the vdso_enabled table. patch15 in V5 removes the vm_table. - modify the change log of patch14 - clarify test steps. Changes in v4: - due to my mistake, the previous version sent 15 patches twice. Please ignore that, as this version is the correct one. - change all "static struct ctl_table" type into "static const struct ctl_table" type in patch1~10,12,13,14 - simplify result of rpcauth_cache_shrink_count() in patch11 Changes in v3: - change patch1~10, patch14 title suggested by Joel Granados - change sysctl_stat_interval to static type in patch1 - add acked-by from Paul Moore in patch7 - change dirtytime_expire_interval to static type in patch9 - add acked-by from Anna Schumaker in patch11 Changes in v2: - fix sysctl_max_map_count undeclared issue in mm/nommu.c for patch6 - update changelog for patch7/12, suggested by Kees/Paul - fix patch8, sorry for wrong changes and forget to built with NOMMU - add reviewed-by from Kees except patch8 since patch8 is wrong in v1 - add reviewed-by from Jan Kara, Christian Brauner in patch12 Kaixiong Yu (16): mm: vmstat: move sysctls to mm/vmstat.c mm: filemap: move sysctl to mm/filemap.c mm: swap: move sysctl to mm/swap.c mm: vmscan: move vmscan sysctls to mm/vmscan.c mm: util: move sysctls to mm/util.c mm: mmap: move sysctl to mm/mmap.c security: min_addr: move sysctl to security/min_addr.c mm: nommu: move sysctl to mm/nommu.c fs: fs-writeback: move sysctl to fs/fs-writeback.c fs: drop_caches: move sysctl to fs/drop_caches.c sunrpc: simplify rpcauth_cache_shrink_count() fs: dcache: move the sysctl to fs/dcache.c x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c sysctl: remove the vm_table sysctl: remove unneeded include arch/sh/kernel/vsyscall/vsyscall.c | 20 +++ arch/x86/entry/vdso/vdso32-setup.c | 16 ++- fs/dcache.c | 21 ++- fs/drop_caches.c | 23 ++- fs/fs-writeback.c | 30 ++-- include/linux/dcache.h | 7 +- include/linux/mm.h | 23 --- include/linux/mman.h | 2 - include/linux/swap.h | 9 -- include/linux/vmstat.h | 11 -- include/linux/writeback.h | 4 - kernel/sysctl.c | 221 ----------------------------- mm/filemap.c | 18 ++- mm/internal.h | 10 ++ mm/mmap.c | 54 +++++++ mm/nommu.c | 15 +- mm/swap.c | 16 ++- mm/swap.h | 1 + mm/util.c | 67 +++++++-- mm/vmscan.c | 23 +++ mm/vmstat.c | 44 +++++- net/sunrpc/auth.c | 2 +- security/min_addr.c | 11 ++ 23 files changed, 336 insertions(+), 312 deletions(-)