[PATCH 30/60] mm/memory_hotplug: keep private memory out of the auto-movable ratio

From: Gregory Price via B4 Relay

Date: Fri Nov 20 2026 - 13:15:11 EST


From: "Gregory Price (Meta)" <gourry@xxxxxxxxxx>

The auto-movable online policy keeps ZONE_MOVABLE within
auto_movable_ratio of the early kernel memory, since kernel memory
holds the metadata movable memory needs. It counts all populated zones.

Private memory in ZONE_NORMAL is counted as kernel memory, but no
kernel allocation can use it. The policy can then online more
ZONE_MOVABLE than kernel memory can support.

Leave zones and dynamic memory groups on private nodes out of the
statistics the ratio is computed from, as ZONE_DEVICE memory already is.

Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
---
mm/memory_hotplug.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b4d94021d46e..d7ce60c6815f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -782,6 +782,10 @@ struct auto_movable_stats {
static void auto_movable_stats_account_zone(struct auto_movable_stats *stats,
struct zone *zone)
{
+ /* Private memory is outside the movable:kernel balance. */
+ if (node_state(zone_to_nid(zone), N_MEMORY_PRIVATE))
+ return;
+
if (zone_idx(zone) == ZONE_MOVABLE) {
stats->movable_pages += zone->present_pages;
} else {
@@ -808,6 +812,10 @@ static int auto_movable_stats_account_group(struct memory_group *group,
struct auto_movable_group_stats *stats = arg;
long pages;

+ /* private memory is outside the movable:kernel balance. */
+ if (node_state(group->nid, N_MEMORY_PRIVATE))
+ return 0;
+
/*
* We don't support modifying the config while the auto-movable online
* policy is already enabled. Just avoid the division by zero below.

--
2.56.1