linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/compaction: do not break pages whose order is larger than target order
@ 2025-04-24 15:38 Wenchao Hao
  2025-04-24 19:42 ` Johannes Weiner
  2025-04-25  6:53 ` Baolin Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Wenchao Hao @ 2025-04-24 15:38 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel; +Cc: Wenchao Hao

When scanning free pages for memory compaction, if the compaction target
order is explicitly specified, do not split pages in buddy whose order
are larger than compaction target order.

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
---
 mm/compaction.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/mm/compaction.c b/mm/compaction.c
index 3925cb61dbb8..b0ed0831c400 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -656,6 +656,17 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
 
 		/* Found a free page, will break it into order-0 pages */
 		order = buddy_order(page);
+
+		/*
+		 * Do not break free pages whose order is larger than
+		 * compact's desired order
+		 */
+		if (cc->order != -1 && order >= cc->order) {
+			blockpfn += (1 << order) - 1;
+			page += (1 << order) - 1;
+			goto isolate_fail;
+		}
+
 		isolated = __isolate_free_page(page, order);
 		if (!isolated)
 			break;
-- 
2.34.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-29 16:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-24 15:38 [PATCH] mm/compaction: do not break pages whose order is larger than target order Wenchao Hao
2025-04-24 19:42 ` Johannes Weiner
2025-04-25 14:28   ` Wenchao Hao
2025-04-25 15:32     ` Johannes Weiner
2025-04-25 17:24       ` Wenchao Hao
2025-04-29 16:44   ` Zi Yan
2025-04-25  6:53 ` Baolin Wang
2025-04-25 14:57   ` Wenchao Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox