linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: compaction: limit the suitable target page order to be less than cc->order
@ 2024-01-22 13:01 Baolin Wang
  2024-01-22 13:01 ` [PATCH 2/2] mm: compaction: update the cc->nr_migratepages when allocating or freeing the freepages Baolin Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Baolin Wang @ 2024-01-22 13:01 UTC (permalink / raw)
  To: akpm; +Cc: mgorman, vbabka, baolin.wang, linux-mm, linux-kernel

It can not improve the fragmentation if we isolate the target free pages
exceeding cc->order, especially when the cc->order is less than pageblock_order.
For example, suppose the pageblock_order is MAX_ORDER (size is 4M) and cc->order
is 2M THP size, we should not isolate other 2M free pages to be the migration
target, which can not improve the fragmentation.

Moreover this is also applicable for large folio compaction.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/compaction.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 27ada42924d5..066b72b3471a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1346,12 +1346,14 @@ static bool suitable_migration_target(struct compact_control *cc,
 {
 	/* If the page is a large free page, then disallow migration */
 	if (PageBuddy(page)) {
+		int order = cc->order > 0 ? cc->order : pageblock_order;
+
 		/*
 		 * We are checking page_order without zone->lock taken. But
 		 * the only small danger is that we skip a potentially suitable
 		 * pageblock, so it's not worth to check order for valid range.
 		 */
-		if (buddy_order_unsafe(page) >= pageblock_order)
+		if (buddy_order_unsafe(page) >= order)
 			return false;
 	}
 
-- 
2.39.3



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

end of thread, other threads:[~2024-02-21 22:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22 13:01 [PATCH 1/2] mm: compaction: limit the suitable target page order to be less than cc->order Baolin Wang
2024-01-22 13:01 ` [PATCH 2/2] mm: compaction: update the cc->nr_migratepages when allocating or freeing the freepages Baolin Wang
2024-02-01 10:30   ` Mel Gorman
2024-02-12 10:32   ` Vlastimil Babka
2024-02-19  2:34     ` Baolin Wang
2024-02-01 10:29 ` [PATCH 1/2] mm: compaction: limit the suitable target page order to be less than cc->order Mel Gorman
2024-02-12  9:13 ` Vlastimil Babka
2024-02-12 15:00   ` Zi Yan
2024-02-19  2:55     ` Baolin Wang
2024-02-21 22:15       ` Andrew Morton
2024-02-21 22:22         ` Vlastimil Babka

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