[PATCH 2/5] mm/compaction: set compact_cached_free_pfn correctly in update_pageblock_skip

Kemeng Shi posted 5 patches 2 years, 6 months ago
There is a newer version of this series
[PATCH 2/5] mm/compaction: set compact_cached_free_pfn correctly in update_pageblock_skip
Posted by Kemeng Shi 2 years, 6 months ago
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>
---
 mm/compaction.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index d1d28d57e5bd..4a784872565a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1690,7 +1690,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) {
-- 
2.30.0
Re: [PATCH 2/5] mm/compaction: set compact_cached_free_pfn correctly in update_pageblock_skip
Posted by Baolin Wang 2 years, 6 months ago

On 7/30/2023 1:43 AM, Kemeng Shi wrote:
> 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.

Looks reasonable to me.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
>   mm/compaction.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index d1d28d57e5bd..4a784872565a 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1690,7 +1690,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) {