[RFC PATCH 2/7] Disallows high-order movable allocations in other zones if ZONE_MOVABLE is populated

From: kaiyang2
Date: Tue Mar 19 2024 - 22:42:45 EST


From: Kaiyang Zhao <kaiyang2@xxxxxxxxxx>

Use ZONE_MOVABLE exclusively for non-0 order allocations

Signed-off-by: Kaiyang Zhao <zh_kaiyang@xxxxxxxxxxx>
---
mm/page_alloc.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 47421bedc12b..9ad9357e340a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3403,6 +3403,16 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
struct page *page;
unsigned long mark;

+ /*
+ * Disallows high-order movable allocations in other zones if
+ * ZONE_MOVABLE is populated on this node.
+ */
+ if (ac->highest_zoneidx >= ZONE_MOVABLE &&
+ order > 0 &&
+ zone_idx(zone) != ZONE_MOVABLE &&
+ populated_zone(&(zone->zone_pgdat->node_zones[ZONE_MOVABLE])))
+ continue;
+
if (cpusets_enabled() &&
(alloc_flags & ALLOC_CPUSET) &&
!__cpuset_zone_allowed(zone, gfp_mask))
--
2.40.1