Commit a2864a67 authored by Kemeng Shi's avatar Kemeng Shi Committed by Andrew Morton

mm/compaction: merge end_pfn boundary check in isolate_freepages_range

Merge the end_pfn boundary check for single page block forward and
multiple page blocks forward to avoid do twice boundary check for multiple
page blocks forward.

Link: https://lkml.kernel.org/r/20230803094901.2915942-3-shikemeng@huaweicloud.comSigned-off-by: default avatarKemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 16951789
...@@ -740,8 +740,6 @@ isolate_freepages_range(struct compact_control *cc, ...@@ -740,8 +740,6 @@ isolate_freepages_range(struct compact_control *cc,
/* Protect pfn from changing by isolate_freepages_block */ /* Protect pfn from changing by isolate_freepages_block */
unsigned long isolate_start_pfn = pfn; unsigned long isolate_start_pfn = pfn;
block_end_pfn = min(block_end_pfn, end_pfn);
/* /*
* pfn could pass the block_end_pfn if isolated freepage * pfn could pass the block_end_pfn if isolated freepage
* is more than pageblock order. In this case, we adjust * is more than pageblock order. In this case, we adjust
...@@ -750,9 +748,10 @@ isolate_freepages_range(struct compact_control *cc, ...@@ -750,9 +748,10 @@ isolate_freepages_range(struct compact_control *cc,
if (pfn >= block_end_pfn) { if (pfn >= block_end_pfn) {
block_start_pfn = pageblock_start_pfn(pfn); block_start_pfn = pageblock_start_pfn(pfn);
block_end_pfn = pageblock_end_pfn(pfn); block_end_pfn = pageblock_end_pfn(pfn);
block_end_pfn = min(block_end_pfn, end_pfn);
} }
block_end_pfn = min(block_end_pfn, end_pfn);
if (!pageblock_pfn_to_page(block_start_pfn, if (!pageblock_pfn_to_page(block_start_pfn,
block_end_pfn, cc->zone)) block_end_pfn, cc->zone))
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment