[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220220060125.13904-1-tangmeng@uniontech.com>
Date: Sun, 20 Feb 2022 14:01:25 +0800
From: tangmeng <tangmeng@...ontech.com>
To: mike.kravetz@...cle.com, mcgrof@...nel.org, keescook@...omium.org,
yzaikin@...gle.com
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, nizhen@...ontech.com,
zhanglianjie@...ontech.com, nixiaoming@...wei.com,
tangmeng <tangmeng@...ontech.com>
Subject: [PATCH 07/11] fs/hugetlbfs: move hugetlibfs sysctls to its own file
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 <tangmeng@...ontech.com>
---
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
Powered by blists - more mailing lists