mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
mm, compaction: do not recheck suitable_migration_target under lock
isolate_freepages_block() rechecks if the pageblock is suitable to be a target for migration after it has taken the zone->lock. However, the check has been optimized to occur only once per pageblock, and compact_checklock_irqsave() might be dropping and reacquiring lock, which means somebody else might have changed the pageblock's migratetype meanwhile. Furthermore, nothing prevents the migratetype to change right after isolate_freepages_block() has finished isolating. Given how imperfect this is, it's simpler to just rely on the check done in isolate_freepages() without lock, and not pretend that the recheck under lock guarantees anything. It is just a heuristic after all. Signed-off-by: Vlastimil Babka <[email protected]> Reviewed-by: Zhang Yanfei <[email protected]> Acked-by: Minchan Kim <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Michal Nazarewicz <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Rik van Riel <[email protected]> Acked-by: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
98dd3b48a7
commit
f8224aa5a0
1 file changed
-13
@@ -276,7 +276,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
|
||||
struct page *cursor, *valid_page = NULL;
|
||||
unsigned long flags;
|
||||
bool locked = false;
|
||||
bool checked_pageblock = false;
|
||||
|
||||
cursor = pfn_to_page(blockpfn);
|
||||
|
||||
@@ -307,18 +306,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
|
||||
if (!locked)
|
||||
break;
|
||||
|
||||
/* Recheck this is a suitable migration target under lock */
|
||||
if (!strict && !checked_pageblock) {
|
||||
/*
|
||||
* We need to check suitability of pageblock only once
|
||||
* and this isolate_freepages_block() is called with
|
||||
* pageblock range, so just check once is sufficient.
|
||||
*/
|
||||
checked_pageblock = true;
|
||||
if (!suitable_migration_target(page))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Recheck this is a buddy page under lock */
|
||||
if (!PageBuddy(page))
|
||||
goto isolate_fail;
|
||||
|
||||
Reference in new issue
Block a user