Skip to contentSkip to conversation

mm: hugetlb: move hugeltb sysctls to its own file

PATCH Superseded Kefeng Wang 5 participants 8 messages Mar 9, 2023 – Mar 10, 2023

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: hugetlb: move hugeltb sysctls to its own file

This moves all hugetlb sysctls to its own file, also kill an useless hugetlb_treat_movable_handler() defination.

---
 include/linux/hugetlb.h |  8 -------
 kernel/sysctl.c         | 32 --------------------------
 mm/hugetlb.c            | 51 ++++++++++++++++++++++++++++++++++++++---
 3 files changed, 48 insertions(+), 43 deletions(-)
include/linux/hugetlb.h +0 -8
index 7c977d234aba..4056b05d81ed 100644
@@ -124,14 +124,6 @@ void hugepage_put_subpool(struct hugepage_subpool *spool);
 
 void hugetlb_dup_vma_private(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,
 			     unsigned long old_addr, unsigned long new_addr,
kernel/sysctl.c +0 -32
index c14552a662ae..ce0297acf97c 100644
@@ -2140,38 +2140,6 @@ static struct ctl_table vm_table[] = {
 		.extra1		= SYSCTL_ZERO,
 		.extra2		= SYSCTL_ONE,
 	},
-#endif
-#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	= "hugetlb_shm_group",
-		.data		= &sysctl_hugetlb_shm_group,
-		.maxlen		= sizeof(gid_t),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	 },
-	{
-		.procname	= "nr_overcommit_hugepages",
-		.data		= NULL,
-		.maxlen		= sizeof(unsigned long),
-		.mode		= 0644,
-		.proc_handler	= hugetlb_overcommit_handler,
-	},
 #endif
 	{
 		.procname	= "lowmem_reserve_ratio",
mm/hugetlb.c +48 -3

87 lines not on this page · raw message

Signature · 1 line
2.35.3
maintainer
#2 lore raw
Quoted 2 lines · On Thu, 9 Mar 2023 12:34:56 -0800 Luis Chamberlain <[email protected]> wrote:

Mike and hugetlb gang, are you OK with me taking this patch through sysctl-next to avoid conflicts as we trim down kernel/sysctl.c ?

Sure, go ahead. Stephen will tell us if there's a collision with mm-git material.

#3 lore raw
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Thu, 9 Mar 2023 12:34:56 -0800 Luis Chamberlain <[email protected]> wrote:

Mike and hugetlb gang, are you OK with me taking this patch through sysctl-next to avoid conflicts as we trim down kernel/sysctl.c ?

Sure, go ahead. Stephen will tell us if there's a collision with mm-git material.

OK thanks, merged onto sysct-next ! Who knows maybe this release we'll trim down completely that large kernel/sysctl.c file finally.

Luis

Reviewed-by on v1 1/1
#4 lore raw
In reply to Kefeng Wang
Quoted 2 lines · Kefeng Wang

This moves all hugetlb sysctls to its own file, also kill an useless hugetlb_treat_movable_handler() defination.

I guess hugetlb_treat_movable_handler should have been removed as part of commit d6cb41cc44c6 mm, hugetlb: remove hugepages_treat_as_movable sysctl.

Quoted 7 lines
---
 include/linux/hugetlb.h |  8 -------
 kernel/sysctl.c         | 32 --------------------------
 mm/hugetlb.c            | 51 ++++++++++++++++++++++++++++++++++++++---
 3 files changed, 48 insertions(+), 43 deletions(-)

Thanks! Changes look fine to me,

Signature · 1 line
Mike Kravetz
#6 lore raw
In reply to Kefeng Wang

mm/hugetlb.c static void __init hugetlb_sysfs_init(void) · line 4206

Quoted 13 lines · Kefeng Wang

This moves all hugetlb sysctls to its own file, also kill an useless hugetlb_treat_movable_handler() defination.

---
  include/linux/hugetlb.h |  8 -------
  kernel/sysctl.c         | 32 --------------------------
  mm/hugetlb.c            | 51 ++++++++++++++++++++++++++++++++++++++---
  3 files changed, 48 insertions(+), 43 deletions(-)
mm/hugetlb.c +2 -0
+#ifdef CONFIG_SYSCTL
+static void hugetlb_sysctl_init(void);

Hi Luis,this should add __init as it is called by hugetlb_init, could you help to change it, or I could send a new patch.

Quoted 13 lines
mm/hugetlb.c +5 -0
+#else
+static inline void hugetlb_sysctl_init(void) { }
+#endif
+
  static int __init hugetlb_init(void)
  {
  	int i;
@@ -4257,6 +4263,7 @@ static int __init hugetlb_init(void)
 
  	hugetlb_sysfs_init();
  	hugetlb_cgroup_file_init();
+	hugetlb_sysctl_init();
 

...

mm/hugetlb.c int hugetlb_overcommit_handler(struct ctl_table *table, int write, · line 4678

Quoted 2 lines
mm/hugetlb.c +2 -0
+
+static void hugetlb_sysctl_init(void)

ditto, sorry for the mistake.

Thanks.

Quoted 6 lines
mm/hugetlb.c +3 -0
+{
+	register_sysctl_init("vm", hugetlb_table);
+}
  #endif /* CONFIG_SYSCTL */
 
  void hugetlb_report_meminfo(struct seq_file *m)
#7 lore raw
Quoted 33 lines · Kefeng Wang

mm/hugetlb.c static void __init hugetlb_sysfs_init(void) · line 4206

Quoted 13 lines · Kefeng Wang

This moves all hugetlb sysctls to its own file, also kill an useless hugetlb_treat_movable_handler() defination.

---
  include/linux/hugetlb.h |  8 -------
  kernel/sysctl.c         | 32 --------------------------
  mm/hugetlb.c            | 51 ++++++++++++++++++++++++++++++++++++++---
  3 files changed, 48 insertions(+), 43 deletions(-)
mm/hugetlb.c +2 -0
+#ifdef CONFIG_SYSCTL
+static void hugetlb_sysctl_init(void);

Hi Luis,this should add __init as it is called by hugetlb_init, could you help to change it, or I could send a new patch.

Quoted 11 lines
mm/hugetlb.c +5 -0
+#else
+static inline void hugetlb_sysctl_init(void) { }
+#endif
+
  static int __init hugetlb_init(void)
  {
  	int i;
@@ -4257,6 +4263,7 @@ static int __init hugetlb_init(void)
  	hugetlb_sysfs_init();
  	hugetlb_cgroup_file_init();
+	hugetlb_sysctl_init();

...

Quoted 4 lines

mm/hugetlb.c int hugetlb_overcommit_handler(struct ctl_table *table, int write, · line 4678

Quoted 2 lines
mm/hugetlb.c +2 -0
+
+static void hugetlb_sysctl_init(void)

ditto, sorry for the mistake.

Just send a fix.

Luis