linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 07/11] fs/hugetlbfs: move hugetlibfs sysctls to its own file
@ 2022-02-20  6:01 tangmeng
  0 siblings, 0 replies; only message in thread
From: tangmeng @ 2022-02-20  6:01 UTC (permalink / raw)
  To: mike.kravetz, mcgrof, keescook, yzaikin
  Cc: linux-kernel, linux-mm, linux-fsdevel, nizhen, zhanglianjie,
	nixiaoming, tangmeng

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@uniontech.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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-20  6:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20  6:01 [PATCH 07/11] fs/hugetlbfs: move hugetlibfs sysctls to its own file tangmeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox