Skip to contentSkip to conversation

mm/hugetlb: move hugetlib sysctls to its own file

PATCH Superseded tangmeng 1 participant 1 message Feb 20, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

tangmeng

author
#0 lore raw

PATCH 8/11 mm/hugetlb: move hugetlib 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 hugetlb sysctls to its own file, mm/hugetlb.c.

'hugetlb_treat_movable_handler' is not currently used, so only delete it from the linux/hugetlb.h.

---
 include/linux/hugetlb.h |  8 --------
 kernel/sysctl.c         | 26 ------------------------
 mm/hugetlb.c            | 44 ++++++++++++++++++++++++++++++++++++++---
 3 files changed, 41 insertions(+), 37 deletions(-)
include/linux/hugetlb.h +0 -8
index f307e1963851..bf807418828a 100644
@@ -13,7 +13,6 @@
 #include <linux/gfp.h>
 #include <linux/userfaultfd_k.h>
 
-struct ctl_table;
 struct user_struct;
 struct mmu_gather;
 
@@ -125,13 +124,6 @@ void hugepage_put_subpool(struct hugepage_subpool *spool);
 
 void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
 void clear_vma_resv_huge_pages(struct vm_area_struct *vma);
-int hugetlb_sysctl_handler(struct ctl_table *, int, void *, size_t *, loff_t *);
-int hugetlb_overcommit_handler(struct ctl_table *, int, void *, size_t *,
-		loff_t *);
-int hugetlb_treat_movable_handler(struct ctl_table *, int, void *, size_t *,
-		loff_t *);
-int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int, void *, size_t *,
-		loff_t *);
 
 int move_hugetlb_page_tables(struct vm_area_struct *vma,
 			     struct vm_area_struct *new_vma,
kernel/sysctl.c +0 -26
index dc5e313c9e6b..1a1504862f4f 100644
@@ -43,7 +43,6 @@
 #include <linux/writeback.h>
 #include <linux/ratelimit.h>
 #include <linux/compaction.h>
-#include <linux/hugetlb.h>
 #include <linux/initrd.h>
 #include <linux/key.h>
 #include <linux/times.h>
@@ -2176,31 +2175,6 @@ static struct ctl_table vm_table[] = {
 		.extra1		= SYSCTL_ZERO,
 		.extra2		= SYSCTL_TWO_HUNDRED,
 	},
-#ifdef CONFIG_HUGETLB_PAGE
-	{
-		.procname	= "nr_hugepages",
-		.data		= NULL,
-		.maxlen		= sizeof(unsigned long),
-		.mode		= 0644,
-		.proc_handler	= hugetlb_sysctl_handler,
-	},
-#ifdef CONFIG_NUMA
-	{
-		.procname       = "nr_hugepages_mempolicy",
-		.data           = NULL,
-		.maxlen         = sizeof(unsigned long),
-		.mode           = 0644,
-		.proc_handler   = &hugetlb_mempolicy_sysctl_handler,
-	},
-#endif
-	{
-		.procname	= "nr_overcommit_hugepages",
-		.data		= NULL,
-		.maxlen		= sizeof(unsigned long),
-		.mode		= 0644,
-		.proc_handler	= hugetlb_overcommit_handler,
-	},
-#endif
 	{
 		.procname	= "lowmem_reserve_ratio",
 		.data		= &sysctl_lowmem_reserve_ratio,
mm/hugetlb.c +41 -3

65 lines not on this page · raw message

Signature · 1 line
2.20.1