diff mbox series

[3/4] mm, compaction: Finish scanning the current pageblock if requested

Message ID 20230125134434.18017-4-mgorman@techsingularity.net (mailing list archive)
State New
Headers show
Series Fix excessive CPU usage during compaction | expand

Commit Message

Mel Gorman Jan. 25, 2023, 1:44 p.m. UTC
cc->finish_pageblock is set when the current pageblock should be
rescanned but fast_find_migrateblock can select an alternative
block. Disable fast_find_migrateblock when the current pageblock
scan should be completed.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
---
 mm/compaction.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Vlastimil Babka Feb. 7, 2023, 5:10 p.m. UTC | #1
On 1/25/23 14:44, Mel Gorman wrote:
> cc->finish_pageblock is set when the current pageblock should be
> rescanned but fast_find_migrateblock can select an alternative
> block. Disable fast_find_migrateblock when the current pageblock
> scan should be completed.
> 
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>

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

> ---
>  mm/compaction.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 28711a21a8a2..4b3a0238879c 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1762,6 +1762,13 @@ static unsigned long fast_find_migrateblock(struct compact_control *cc)
>  	if (cc->ignore_skip_hint)
>  		return pfn;
>  
> +	/*
> +	 * If the pageblock should be finished then do not select a different
> +	 * pageblock.
> +	 */
> +	if (cc->finish_pageblock)
> +		return pfn;
> +
>  	/*
>  	 * If the migrate_pfn is not at the start of a zone or the start
>  	 * of a pageblock then assume this is a continuation of a previous
diff mbox series

Patch

diff --git a/mm/compaction.c b/mm/compaction.c
index 28711a21a8a2..4b3a0238879c 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1762,6 +1762,13 @@  static unsigned long fast_find_migrateblock(struct compact_control *cc)
 	if (cc->ignore_skip_hint)
 		return pfn;
 
+	/*
+	 * If the pageblock should be finished then do not select a different
+	 * pageblock.
+	 */
+	if (cc->finish_pageblock)
+		return pfn;
+
 	/*
 	 * If the migrate_pfn is not at the start of a zone or the start
 	 * of a pageblock then assume this is a continuation of a previous