[PATCH 18/60] mm/khugepaged: base the recommended min_free_kbytes on common memory

From: Gregory Price via B4 Relay

Date: Fri Nov 20 2026 - 13:13:01 EST


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

set_recommended_min_free_kbytes() reserves two pageblocks per populated
zone to help THP allocations avoid fragmentation. The reserve serves
ordinary allocations, which use only common memory, so count only the
zones on N_MEMORY_COMMON nodes.

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

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 2dc4245814df..a930d99f89da 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -3151,6 +3151,9 @@ void set_recommended_min_free_kbytes(void)
}

for_each_populated_zone(zone) {
+ if (!node_state(zone_to_nid(zone), N_MEMORY_COMMON))
+ continue;
+
/*
* We don't need to worry about fragmentation of
* ZONE_MOVABLE since it only has movable pages.

--
2.56.1