[PATCH 07/11] fs/hugetlbfs: move hugetlibfs sysctls to its own file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 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






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux