diff mbox series

[RFC,4/8] arch_numa: Avoid onlining empty NUMA nodes

Message ID 20240529171236.32002-5-Jonathan.Cameron@huawei.com (mailing list archive)
State New, archived
Headers show
Series arm64/memblock: Handling of CXL Fixed Memory Windows. | expand

Commit Message

Jonathan Cameron May 29, 2024, 5:12 p.m. UTC
ACPI can declare NUMA nodes for memory that will be along later.
CXL Fixed Memory Windows may also be assigned NUMA nodes that
are initially empty.  Currently the generic arch_numa handling will
online these empty nodes. This is both inconsistent with x86 and
with itself as if we add memory and remove it again the node goes
away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/base/arch_numa.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Yuquan Wang Aug. 1, 2024, 7:53 a.m. UTC | #1
On Wed, May 29, 2024 at 06:12:32PM +0100, Jonathan Cameron wrote:
> ACPI can declare NUMA nodes for memory that will be along later.
> CXL Fixed Memory Windows may also be assigned NUMA nodes that
> are initially empty.  Currently the generic arch_numa handling will
> online these empty nodes. This is both inconsistent with x86 and
> with itself as if we add memory and remove it again the node goes
> away.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/base/arch_numa.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
> index 5b59d133b6af..0630efb696ab 100644
> --- a/drivers/base/arch_numa.c
> +++ b/drivers/base/arch_numa.c
> @@ -363,6 +363,11 @@ static int __init numa_register_nodes(void)
>  		unsigned long start_pfn, end_pfn;
>  
>  		get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
> +		if (start_pfn >= end_pfn &&
> +		    !node_state(nid, N_CPU) &&
> +		    !node_state(nid, N_GENERIC_INITIATOR))
> +			continue;
> +
>  		setup_node_data(nid, start_pfn, end_pfn);
>  		node_set_online(nid);
>  	}
> -- 
> 2.39.2
>

Tested-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
diff mbox series

Patch

diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index 5b59d133b6af..0630efb696ab 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -363,6 +363,11 @@  static int __init numa_register_nodes(void)
 		unsigned long start_pfn, end_pfn;
 
 		get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
+		if (start_pfn >= end_pfn &&
+		    !node_state(nid, N_CPU) &&
+		    !node_state(nid, N_GENERIC_INITIATOR))
+			continue;
+
 		setup_node_data(nid, start_pfn, end_pfn);
 		node_set_online(nid);
 	}