Vlastimil correctly pointed out that when a fast search fails and cc->migrate_pfn is reinitialised to the lowest PFN found that the caller does not use the updated PFN. This is a fix for the mmotm patch mm-compaction-use-free-lists-to-quickly-locate-a-migration-source.patch Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> diff --git a/mm/compaction.c b/mm/compaction.c index 92d10eb3d1c7..d249f257da7e 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1238,14 +1238,16 @@ update_fast_start_pfn(struct compact_control *cc, unsigned long pfn) cc->fast_start_pfn = min(cc->fast_start_pfn, pfn); } -static inline void +static inline unsigned long reinit_migrate_pfn(struct compact_control *cc) { if (!cc->fast_start_pfn || cc->fast_start_pfn == ULONG_MAX) - return; + return cc->migrate_pfn; cc->migrate_pfn = cc->fast_start_pfn; cc->fast_start_pfn = ULONG_MAX; + + return cc->migrate_pfn; } /* @@ -1361,7 +1363,7 @@ static unsigned long fast_find_migrateblock(struct compact_control *cc) * that had free pages as the basis for starting a linear scan. */ if (pfn == cc->migrate_pfn) - reinit_migrate_pfn(cc); + pfn = reinit_migrate_pfn(cc); return pfn; }