Skip to content

Commit

Permalink
mm: compaction: simplify free block check in suitable_migration_target()
Browse files Browse the repository at this point in the history
Free page blocks are now marked MIGRATE_FREE. Consult that directly.

Signed-off-by: Johannes Weiner <[email protected]>
  • Loading branch information
hnaz committed Mar 9, 2023
1 parent 4f28f80 commit 7ddf44b
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 7ddf44b

Please sign in to comment.