linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] mm: numa_clear_kernel_node_hotplug: Add NUMA_NO_NODE check for node id
@ 2024-10-16  5:37 Nobuhiro Iwamatsu
  2024-10-16  8:12 ` Mike Rapoport
  0 siblings, 1 reply; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2024-10-16  5:37 UTC (permalink / raw)
  To: linux-mm, Andrew Morton
  Cc: linux-kernel, yuji2.ishikawa, Nobuhiro Iwamatsu, Mike Rapoport

The acquired memory blocks for reserved may include blocks outside of
memory management. In this case, the nid variable is set to NUMA_NO_NODE
(-1), so an error occurs in node_set().
This adds a check to numa_clear_kernel_node_hotplug that skips node_set
when nid is set to NUMA_NO_NODE.

Fixes: 87482708210f ("mm: introduce numa_memblks")
Suggested-by: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 mm/numa_memblks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c
index be52b93a9c58..b982f9260872 100644
--- a/mm/numa_memblks.c
+++ b/mm/numa_memblks.c
@@ -349,7 +349,7 @@ static void __init numa_clear_kernel_node_hotplug(void)
 	for_each_reserved_mem_region(mb_region) {
 		int nid = memblock_get_region_node(mb_region);
 
-		if (nid != MAX_NUMNODES)
+		if (nid != NUMA_NO_NODE && nid != MAX_NUMNODES)
 			node_set(nid, reserved_nodemask);
 	}
 
-- 
2.45.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RFC] mm: numa_clear_kernel_node_hotplug: Add NUMA_NO_NODE check for node id
  2024-10-16  5:37 [PATCH RFC] mm: numa_clear_kernel_node_hotplug: Add NUMA_NO_NODE check for node id Nobuhiro Iwamatsu
@ 2024-10-16  8:12 ` Mike Rapoport
  2024-10-16  8:58   ` nobuhiro1.iwamatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Rapoport @ 2024-10-16  8:12 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: linux-mm, Andrew Morton, linux-kernel, yuji2.ishikawa

On Wed, Oct 16, 2024 at 02:37:10PM +0900, Nobuhiro Iwamatsu wrote:
> The acquired memory blocks for reserved may include blocks outside of
> memory management. In this case, the nid variable is set to NUMA_NO_NODE
> (-1), so an error occurs in node_set().
> This adds a check to numa_clear_kernel_node_hotplug that skips node_set
> when nid is set to NUMA_NO_NODE.
> 
> Fixes: 87482708210f ("mm: introduce numa_memblks")
> Suggested-by: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
>  mm/numa_memblks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c
> index be52b93a9c58..b982f9260872 100644
> --- a/mm/numa_memblks.c
> +++ b/mm/numa_memblks.c
> @@ -349,7 +349,7 @@ static void __init numa_clear_kernel_node_hotplug(void)
>  	for_each_reserved_mem_region(mb_region) {
>  		int nid = memblock_get_region_node(mb_region);
>  
> -		if (nid != MAX_NUMNODES)
> +		if (nid != NUMA_NO_NODE && nid != MAX_NUMNODES)

We have numa_valid_node() check for this, please use that.
Otherwise

Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

>  			node_set(nid, reserved_nodemask);
>  	}
>  
> -- 
> 2.45.2
> 
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH RFC] mm: numa_clear_kernel_node_hotplug: Add NUMA_NO_NODE check for node id
  2024-10-16  8:12 ` Mike Rapoport
@ 2024-10-16  8:58   ` nobuhiro1.iwamatsu
  0 siblings, 0 replies; 3+ messages in thread
From: nobuhiro1.iwamatsu @ 2024-10-16  8:58 UTC (permalink / raw)
  To: rppt; +Cc: linux-mm, akpm, linux-kernel, yuji2.ishikawa

Hi Mike,

> -----Original Message-----
> From: Mike Rapoport <rppt@kernel.org>
> Sent: Wednesday, October 16, 2024 5:12 PM
> To: iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○OST)
> <nobuhiro1.iwamatsu@toshiba.co.jp>
> Cc: linux-mm@kvack.org; Andrew Morton <akpm@linux-foundation.org>;
> linux-kernel@vger.kernel.org; ishikawa yuji(石川 悠司 ○RDC□AITC○
> EA開) <yuji2.ishikawa@toshiba.co.jp>
> Subject: Re: [PATCH RFC] mm: numa_clear_kernel_node_hotplug: Add
> NUMA_NO_NODE check for node id
> 
> On Wed, Oct 16, 2024 at 02:37:10PM +0900, Nobuhiro Iwamatsu wrote:
> > The acquired memory blocks for reserved may include blocks outside of
> > memory management. In this case, the nid variable is set to
> > NUMA_NO_NODE (-1), so an error occurs in node_set().
> > This adds a check to numa_clear_kernel_node_hotplug that skips
> > node_set when nid is set to NUMA_NO_NODE.
> >
> > Fixes: 87482708210f ("mm: introduce numa_memblks")
> > Suggested-by: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
> > Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
> > Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
> > ---
> >  mm/numa_memblks.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c index
> > be52b93a9c58..b982f9260872 100644
> > --- a/mm/numa_memblks.c
> > +++ b/mm/numa_memblks.c
> > @@ -349,7 +349,7 @@ static void __init
> numa_clear_kernel_node_hotplug(void)
> >  	for_each_reserved_mem_region(mb_region) {
> >  		int nid = memblock_get_region_node(mb_region);
> >
> > -		if (nid != MAX_NUMNODES)
> > +		if (nid != NUMA_NO_NODE && nid != MAX_NUMNODES)
> 
> We have numa_valid_node() check for this, please use that.

Thanks. I will send v2 with it.

> Otherwise
> 
> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> 
> >  			node_set(nid, reserved_nodemask);
> >  	}
> >
> > --
> > 2.45.2
> >
> >
> 
> --
> Sincerely yours,
> Mike.

Best regards,
  Nobuhiro



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-16  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-16  5:37 [PATCH RFC] mm: numa_clear_kernel_node_hotplug: Add NUMA_NO_NODE check for node id Nobuhiro Iwamatsu
2024-10-16  8:12 ` Mike Rapoport
2024-10-16  8:58   ` nobuhiro1.iwamatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox