[v2,1/4] mm/compaction: set compact_cached_free_pfn correctly in update_pageblock_skip

Message ID 20230803094901.2915942-2-shikemeng@huaweicloud.com
State New
Headers
Series Fixes and cleanups to compaction |

Commit Message

Kemeng Shi Aug. 3, 2023, 9:48 a.m. UTC
  We will set skip to page block of block_start_pfn, it's more reasonable
to set compact_cached_free_pfn to page block before the block_start_pfn.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/compaction.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/mm/compaction.c b/mm/compaction.c
index fbf50a9e4d23..61f56cee3715 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1714,7 +1714,8 @@  static void isolate_freepages(struct compact_control *cc)
 
 		/* Update the skip hint if the full pageblock was scanned */
 		if (isolate_start_pfn == block_end_pfn)
-			update_pageblock_skip(cc, page, block_start_pfn);
+			update_pageblock_skip(cc, page, block_start_pfn -
+					      pageblock_nr_pages);
 
 		/* Are enough freepages isolated? */
 		if (cc->nr_freepages >= cc->nr_migratepages) {