Set private node watermarks to 0 (reclaim isn't supported yet, so they
are pointless), and do not include private nodes in system reserves.

The oom killer can't actually resolve general system pressure by
releasing private node capacity, so including them in system reserve
calculations dilutes DRAM watermarks and causes poor OOM kill behavior.

Signed-off-by: Gregory Price <[email protected]>
---
 mm/page_alloc.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 78755a55b1540..2b08bea2379a9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6555,6 +6555,10 @@ static void calculate_totalreserve_pages(void)
 
                pgdat->totalreserve_pages = 0;
 
+               /* private nodes have zero watermarks */
+               if (node_is_private(pgdat->node_id))
+                       continue;
+
                for (i = 0; i < MAX_NR_ZONES; i++) {
                        struct zone *zone = pgdat->node_zones + i;
                        long max = 0;
@@ -6647,9 +6651,15 @@ static void __setup_per_zone_wmarks(void)
        struct zone *zone;
        unsigned long flags;
 
-       /* Calculate total number of !ZONE_HIGHMEM and !ZONE_MOVABLE pages */
+       /*
+        * Calculate total number of !ZONE_HIGHMEM and !ZONE_MOVABLE pages
+        *
+        * Private nodes are excluded because they are not in the regular
+        * allocation fallback path - including them dilutes DRAM watermarks.
+        */
        for_each_zone(zone) {
-               if (!is_highmem(zone) && zone_idx(zone) != ZONE_MOVABLE)
+               if (!is_highmem(zone) && zone_idx(zone) != ZONE_MOVABLE &&
+                   !node_is_private(zone_to_nid(zone)))
                        lowmem_pages += zone_managed_pages(zone);
        }
 
@@ -6657,6 +6667,16 @@ static void __setup_per_zone_wmarks(void)
                u64 tmp;
 
                spin_lock_irqsave(&zone->lock, flags);
+               if (node_is_private(zone_to_nid(zone))) {
+                       zone->_watermark[WMARK_MIN] = 0;
+                       zone->_watermark[WMARK_LOW] = 0;
+                       zone->_watermark[WMARK_HIGH] = 0;
+                       zone->_watermark[WMARK_PROMO] = 0;
+                       zone->watermark_boost = 0;
+                       spin_unlock_irqrestore(&zone->lock, flags);
+                       continue;
+               }
+
                tmp = (u64)pages_min * zone_managed_pages(zone);
                tmp = div64_ul(tmp, lowmem_pages);
                if (is_highmem(zone) || zone_idx(zone) == ZONE_MOVABLE) {
-- 
2.53.0-Meta


Reply via email to