@@ -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,
@@ -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 */
@@ -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,
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(-)