From: Miaohe Lin Date: Fri, 29 Apr 2022 06:16:19 +0000 (-0700) Subject: mm: compaction: make sure highest is above the min_pfn X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ca2864e52d391f8df29da78261592502ffadd9d9;p=linux.git mm: compaction: make sure highest is above the min_pfn It's not guaranteed that highest will be above the min_pfn. If highest is below the min_pfn, migrate_pfn and free_pfn can meet prematurely and lead to some useless work. Make sure highest is above min_pfn to avoid making a futile effort. Link: https://lkml.kernel.org/r/20220418141253.24298-13-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Cc: Charan Teja Kalla Cc: David Hildenbrand Cc: Pintu Kumar Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/mm/compaction.c b/mm/compaction.c index 609a76d7e0517..65970107b7895 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1532,7 +1532,7 @@ fast_isolate_freepages(struct compact_control *cc) * not found, be pessimistic for direct compaction * and use the min mark. */ - if (highest) { + if (highest >= min_pfn) { page = pfn_to_page(highest); cc->free_pfn = highest; } else {