diff mbox series

[RFC,15/26] mm: compaction: simplify free block check in suitable_migration_target()

Message ID 20230418191313.268131-16-hannes@cmpxchg.org (mailing list archive)
State New
Headers show
Series mm: reliable huge page allocator | expand

Commit Message

Johannes Weiner April 18, 2023, 7:13 p.m. UTC
Free page blocks are now marked MIGRATE_FREE. Consult that directly.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/compaction.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Mel Gorman April 21, 2023, 2:39 p.m. UTC | #1
On Tue, Apr 18, 2023 at 03:13:02PM -0400, Johannes Weiner wrote:
> Free page blocks are now marked MIGRATE_FREE. Consult that directly.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Justification for patch depends on whether MIGRATE_FREE is itself
necessaary. Even then, it's a micro-optimisation but maybe it matters
more later.
diff mbox series

Patch

diff --git a/mm/compaction.c b/mm/compaction.c
index a2280001eea3..b9eed0d43403 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1281,22 +1281,17 @@  static bool suitable_migration_source(struct compact_control *cc,
 static bool suitable_migration_target(struct compact_control *cc,
 							struct page *page)
 {
+	int mt = get_pageblock_migratetype(page);
+
 	/* If the page is a large free page, then disallow migration */
-	if (PageBuddy(page)) {
-		/*
-		 * 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)
-			return false;
-	}
+	if (mt == MIGRATE_FREE)
+		return false;
 
 	if (cc->ignore_block_suitable)
 		return true;
 
 	/* If the block is MIGRATE_MOVABLE or MIGRATE_CMA, allow migration */
-	if (is_migrate_movable(get_pageblock_migratetype(page)))
+	if (is_migrate_movable(mt))
 		return true;
 
 	/* Otherwise skip the block */