Re: [PATCH v6 2/5] mm,compaction: Let isolate_migratepages_{range,block} return error codes

From: Oscar Salvador
Date: Tue Mar 23 2021 - 06:49:57 EST


On Fri, Mar 19, 2021 at 02:20:01PM +0100, Oscar Salvador wrote:
> Currently, isolate_migratepages_{range,block} and their callers use
> a pfn == 0 vs pfn != 0 scheme to let the caller know whether there was
> any error during isolation.
> This does not work as soon as we need to start reporting different error
> codes and make sure we pass them down the chain, so they are properly
> interpreted by functions like e.g: alloc_contig_range.
>
> Let us rework isolate_migratepages_{range,block} so we can report error
> codes.
> Since isolate_migratepages_block will stop returning the next pfn to be
> scanned, we reuse the cc->migrate_pfn field to keep track of that.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Hi Andrew,

I realized a missed place wrt. error handling.
could you squash this on top?

diff --git a/mm/compaction.c b/mm/compaction.c
index cd090a675321..9b989fc3168d 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -809,6 +809,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
bool skip_on_failure = false;
unsigned long next_skip_pfn = 0;
bool skip_updated = false;
+ int ret = 0;

cc->migrate_pfn = low_pfn;

@@ -877,8 +878,8 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,

if (fatal_signal_pending(current)) {
cc->contended = true;
+ ret = -EINTR;

- low_pfn = 0;
goto fatal_pending;
}

@@ -1134,7 +1135,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,

cc->migrate_pfn = low_pfn;

- return 0;
+ return ret;
}


Thanks a lot

--
Oscar Salvador
SUSE L3