Skip to contentSkip to conversation

ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG

PATCH In review Vitaly Kuznetsov 2 participants 2 messages Dec 16, 2021 – Dec 17, 2021 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG

Some systems (e.g. Hyper-V guests) have all their memory marked as hotpluggable in SRAT. acpi_numa_memory_affinity_init(), however, ignores all such regions when !CONFIG_MEMORY_HOTPLUG and this is unfortunate as memory affinity (NUMA) information gets lost.

'Hot Pluggable' flag in SRAT only means that "system hardware supports hot-add and hot-remove of this memory region", it doesn't prevent memory from being cold-plugged there.

Ignore 'Hot Pluggable' bit instead of skipping the whole memory affinity information when !CONFIG_MEMORY_HOTPLUG.

---
 drivers/acpi/numa/srat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/numa/srat.c +2 -3
index b8795fc49097..6c884f3e8332 100644
@@ -254,9 +254,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
 	}
 	if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
 		goto out_err;
-	hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
-	if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
-		goto out_err;
+	hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
+		(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE);
 
 	start = ma->base_address;
 	end = start + ma->length;
Signature · 1 line
2.33.1
#1 lore raw
Quoted 6 lines · Vitaly Kuznetsov

Some systems (e.g. Hyper-V guests) have all their memory marked as hotpluggable in SRAT. acpi_numa_memory_affinity_init(), however, ignores all such regions when !CONFIG_MEMORY_HOTPLUG and this is unfortunate as memory affinity (NUMA) information gets lost.

Quoted 8 lines

'Hot Pluggable' flag in SRAT only means that "system hardware supports hot-add and hot-remove of this memory region", it doesn't prevent memory from being cold-plugged there.

Ignore 'Hot Pluggable' bit instead of skipping the whole memory affinity information when !CONFIG_MEMORY_HOTPLUG.

Makes sense to me, so applied as 5.17 material, but CC Dan and Jonathan in case this can be problematic for some mm-related reason.

Quoted 23 lines
---
 drivers/acpi/numa/srat.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/numa/srat.c +2 -4
index b8795fc49097..6c884f3e8332 100644
@@ -254,9 +254,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
        }
        if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
                goto out_err;
-       hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
-       if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
-               goto out_err;
+       hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
+               (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE);
 
        start = ma->base_address;
        end = start + ma->length;
--

2.33.1