Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3233137pxb; Sun, 20 Feb 2022 13:23:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTLoi+B7V28aGRuWpP/FaRCKvMLr99u+/5+p2MuX7kCQsxlKtSr6nXXOz0jy0mV1VI+xcP X-Received: by 2002:a17:90a:ce08:b0:1bc:16cb:343d with SMTP id f8-20020a17090ace0800b001bc16cb343dmr5734627pju.158.1645392232870; Sun, 20 Feb 2022 13:23:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645392232; cv=none; d=google.com; s=arc-20160816; b=piqg+5pYJm3Vk2ZP6k/LIBnr1ZmWSflt3If4ITkVHYxNRE7iE2HKSwaQjGtbwTvpn8 t/rQdZbmwhcSfWHcjAsZ/I35Liy6odli/zxHfuDQsJ8DhE5pRJhyVynYY1lJBlXIHFDt BGvJ2CERwNf5e38Xl5aCAUCrFaHoDje9SZbIghqLKcjuVMAUs6EWLx2BvF8c6HAPqaVO RC1ip/UfQGMNspO7MoF7uM4TdnTHaqwjaaZJV43fgkv4wW2fp/ZW+Ma1+IsDBxfokSE8 5C+y5VLGyGRehCmZFc8qOB18b+33DYSt+yykqv8uc1tTnInKOie9nu3LOsYISUIsHFMM qcNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=b23ttpmlrj1i1NPuKm1LQroNU22rDG36jZwsR4cO6cs=; b=UfhLSNrZRb+RYiUyK5wvE9huAwPvuxQQsuABGhr/YtkfWpLZ+C669bH5wRKr8ytqFx X0OffzqTtKFlaVkyc0vqQmxgxugDYhcH8xb0QrO6TEyaKwHFHOUeFXXwmL8MwsjQWuZ7 KMEgpMHMQvqO/osxYN3nnC3+4UT0tABQOai76+CpQJtQrT0xd5G3h0PPDshYgjOoCAvq bniYfcl7a40CpKrLD13SqETCzAFkvKftQ98GrGiFos8gpRNV/k1mKy04ApdjoUxIhys4 29XkUtofDYTpDfNyx0t9zuGO9NjFMLCwkL8UUdnI/VZcaqwoHWGMDDRShCD0yLIUqNcm 55/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15si6177448pgi.107.2022.02.20.13.23.37; Sun, 20 Feb 2022 13:23:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241371AbiBTGCP (ORCPT + 99 others); Sun, 20 Feb 2022 01:02:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241057AbiBTGCJ (ORCPT ); Sun, 20 Feb 2022 01:02:09 -0500 Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07EC9F63 for ; Sat, 19 Feb 2022 22:01:47 -0800 (PST) X-QQ-mid: bizesmtp76t1645336893tmnmssis Received: from localhost.localdomain (unknown [180.102.102.45]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 20 Feb 2022 14:01:27 +0800 (CST) X-QQ-SSF: 01400000002000B0F000B00A0000000 X-QQ-FEAT: HoyAXBWgsklMLx45Q65e9S1zIxrVT15UuJ2vKorwsFn98tS8WzQL3Ja3N5+YS uCEmB4z3YaBlyXfs4A1mikfBwd4xOHC+I7wNiSQtrEAvnG9MKqTP3NKRXIsoOaX1M4MQfzW CvP58Tlf4BfpiNkohfbUrnJMD8E1M/5aJRCWoTSIr1/QiPtivA/HtsXJxOlZPVrJ2/2g0gq ctA3erE5waMiZGa5L0gvdl2GFjZExQl0GKnzkqDD992KrR5pD0vYy//uzIiMcASfSlAjXNR uiGdDMgCdckwUm5d/hdmGlveNxGlZOomroS5Z8HpQwQOvlM/hmQocQ+4n0zolqJM12bscP8 o/f2wU1j6Cy8WRV/UBI9VFWCpuKqI+BGFHv5DGA X-QQ-GoodBg: 2 From: tangmeng To: mike.kravetz@oracle.com, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, nizhen@uniontech.com, zhanglianjie@uniontech.com, nixiaoming@huawei.com, tangmeng Subject: [PATCH 07/11] fs/hugetlbfs: move hugetlibfs sysctls to its own file Date: Sun, 20 Feb 2022 14:01:25 +0800 Message-Id: <20220220060125.13904-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the hugetlbfs sysctls to its own file, fs/hugetlbfs/inode.c. Signed-off-by: tangmeng --- fs/hugetlbfs/inode.c | 21 ++++++++++++++++++++- include/linux/hugetlb.h | 1 - kernel/sysctl.c | 7 ------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a7c6c7498be0..3f386d9d8ad3 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -62,7 +62,26 @@ struct hugetlbfs_fs_context { umode_t mode; }; -int sysctl_hugetlb_shm_group; +static int sysctl_hugetlb_shm_group; +#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_SYSCTL) +static struct ctl_table vm_hugetlbfs_table[] = { + { + .procname = "hugetlb_shm_group", + .data = &sysctl_hugetlb_shm_group, + .maxlen = sizeof(gid_t), + .mode = 0644, + .proc_handler = proc_dointvec, + }, + { } +}; + +static __init int vm_hugetlbfs_sysctls_init(void) +{ + register_sysctl_init("vm", vm_hugetlbfs_table); + return 0; +} +late_initcall(vm_hugetlbfs_sysctls_init); +#endif enum hugetlb_param { Opt_gid, diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d1897a69c540..f307e1963851 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -181,7 +181,6 @@ pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage); -extern int sysctl_hugetlb_shm_group; extern struct list_head huge_boot_pages; /* arch callbacks */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 31f2c6e21392..dc5e313c9e6b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2193,13 +2193,6 @@ static struct ctl_table vm_table[] = { .proc_handler = &hugetlb_mempolicy_sysctl_handler, }, #endif - { - .procname = "hugetlb_shm_group", - .data = &sysctl_hugetlb_shm_group, - .maxlen = sizeof(gid_t), - .mode = 0644, - .proc_handler = proc_dointvec, - }, { .procname = "nr_overcommit_hugepages", .data = NULL, -- 2.20.1