[4/6] mm: compaction: only set skip flag if cc->no_set_skip_hint is false

Message ID 0eb2cd2407ffb259ae6e3071e10f70f2d41d0f3e.1685018752.git.baolin.wang@linux.alibaba.com
State New
Headers
Series Misc cleanups and improvements for compaction |

Commit Message

Baolin Wang May 25, 2023, 12:53 p.m. UTC
  To keep the same logic as test_and_set_skip(), only set the skip flag
if cc->no_set_skip_hint is false, which makes code more reasonable.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Vlastimil Babka May 30, 2023, 8:03 a.m. UTC | #1
On 5/25/23 14:53, Baolin Wang wrote:
> To keep the same logic as test_and_set_skip(), only set the skip flag
> if cc->no_set_skip_hint is false, which makes code more reasonable.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/compaction.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 1e5183f39ca9..65d8d9223acc 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1223,7 +1223,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>  	 * rescanned twice in a row.
>  	 */
>  	if (low_pfn == end_pfn && (!nr_isolated || cc->finish_pageblock)) {
> -		if (valid_page && !skip_updated)
> +		if (!cc->no_set_skip_hint && valid_page && !skip_updated)
>  			set_pageblock_skip(valid_page);
>  		update_cached_migrate(cc, low_pfn);
>  	}
  

Patch

diff --git a/mm/compaction.c b/mm/compaction.c
index 1e5183f39ca9..65d8d9223acc 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1223,7 +1223,7 @@  isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 	 * rescanned twice in a row.
 	 */
 	if (low_pfn == end_pfn && (!nr_isolated || cc->finish_pageblock)) {
-		if (valid_page && !skip_updated)
+		if (!cc->no_set_skip_hint && valid_page && !skip_updated)
 			set_pageblock_skip(valid_page);
 		update_cached_migrate(cc, low_pfn);
 	}