diff mbox series

[v2] mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE

Message ID 20220609104032.18350-1-songmuchun@bytedance.com (mailing list archive)
State New, archived
Headers show
Series [v2] mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE | expand

Commit Message

Muchun Song June 9, 2022, 10:40 a.m. UTC
"numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if
CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured,
"numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to
fix it.

Fixes: 4518085e127d ("mm, sysctl: make NUMA stats configurable")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Cc: <stable@vger.kernel.org>
---
v2:
 - Simplify the fix, thanks to Michal.

 kernel/sysctl.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

Comments

Michal Hocko June 9, 2022, 11:43 a.m. UTC | #1
On Thu 09-06-22 18:40:32, Muchun Song wrote:
> "numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if
> CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured,
> "numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to
> fix it.
> 
> Fixes: 4518085e127d ("mm, sysctl: make NUMA stats configurable")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Cc: <stable@vger.kernel.org>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> ---
> v2:
>  - Simplify the fix, thanks to Michal.
> 
>  kernel/sysctl.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 50a2c29efc94..485d2b1bc873 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2091,6 +2091,17 @@ static struct ctl_table vm_table[] = {
>  		.extra1		= SYSCTL_ZERO,
>  		.extra2		= SYSCTL_TWO_HUNDRED,
>  	},
> +#ifdef CONFIG_NUMA
> +	{
> +		.procname	= "numa_stat",
> +		.data		= &sysctl_vm_numa_stat,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0644,
> +		.proc_handler	= sysctl_vm_numa_stat_handler,
> +		.extra1		= SYSCTL_ZERO,
> +		.extra2		= SYSCTL_ONE,
> +	},
> +#endif
>  #ifdef CONFIG_HUGETLB_PAGE
>  	{
>  		.procname	= "nr_hugepages",
> @@ -2107,15 +2118,6 @@ static struct ctl_table vm_table[] = {
>  		.mode           = 0644,
>  		.proc_handler   = &hugetlb_mempolicy_sysctl_handler,
>  	},
> -	{
> -		.procname		= "numa_stat",
> -		.data			= &sysctl_vm_numa_stat,
> -		.maxlen			= sizeof(int),
> -		.mode			= 0644,
> -		.proc_handler	= sysctl_vm_numa_stat_handler,
> -		.extra1			= SYSCTL_ZERO,
> -		.extra2			= SYSCTL_ONE,
> -	},
>  #endif
>  	 {
>  		.procname	= "hugetlb_shm_group",
> -- 
> 2.11.0
Luis Chamberlain June 9, 2022, 1:53 p.m. UTC | #2
On Thu, Jun 09, 2022 at 06:40:32PM +0800, Muchun Song wrote:
> "numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if
> CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured,
> "numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to
> fix it.
> 
> Fixes: 4518085e127d ("mm, sysctl: make NUMA stats configurable")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Cc: <stable@vger.kernel.org>

Thanks! Queued onto sysctl-fixes.

  Luis
Mel Gorman June 9, 2022, 3:15 p.m. UTC | #3
On Thu, Jun 09, 2022 at 06:40:32PM +0800, Muchun Song wrote:
> "numa_stat" should not be included in the scope of CONFIG_HUGETLB_PAGE, if
> CONFIG_HUGETLB_PAGE is not configured even if CONFIG_NUMA is configured,
> "numa_stat" is missed form /proc. Move it out of CONFIG_HUGETLB_PAGE to
> fix it.
> 
> Fixes: 4518085e127d ("mm, sysctl: make NUMA stats configurable")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Cc: <stable@vger.kernel.org>

Acked-by: Mel Gorman <mgorman@techsingularity.net>
diff mbox series

Patch

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 50a2c29efc94..485d2b1bc873 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2091,6 +2091,17 @@  static struct ctl_table vm_table[] = {
 		.extra1		= SYSCTL_ZERO,
 		.extra2		= SYSCTL_TWO_HUNDRED,
 	},
+#ifdef CONFIG_NUMA
+	{
+		.procname	= "numa_stat",
+		.data		= &sysctl_vm_numa_stat,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= sysctl_vm_numa_stat_handler,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
+	},
+#endif
 #ifdef CONFIG_HUGETLB_PAGE
 	{
 		.procname	= "nr_hugepages",
@@ -2107,15 +2118,6 @@  static struct ctl_table vm_table[] = {
 		.mode           = 0644,
 		.proc_handler   = &hugetlb_mempolicy_sysctl_handler,
 	},
-	{
-		.procname		= "numa_stat",
-		.data			= &sysctl_vm_numa_stat,
-		.maxlen			= sizeof(int),
-		.mode			= 0644,
-		.proc_handler	= sysctl_vm_numa_stat_handler,
-		.extra1			= SYSCTL_ZERO,
-		.extra2			= SYSCTL_ONE,
-	},
 #endif
 	 {
 		.procname	= "hugetlb_shm_group",