Re: [PATCH] mm/compaction: fix the total_isolated in strict mode
From: Andrew Morton
Date: Mon Nov 11 2024 - 19:27:47 EST
On Sat, 2 Nov 2024 20:16:21 +0000 Qiang Liu <liuq131@xxxxxxxxxxxxxxx> wrote:
> If the last cycle reads bogus compound_order() and blockpfn > end_pfn occurs,
> it is possible that total_isolated will be less than nr_scanned. In this case,
> strict mode should return 0, but the “if (strict && blockpfn < end_pfn)”
> statement cannot recognize this situation
>
> ...
>
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -699,7 +699,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
> * pages requested were isolated. If there were any failures, 0 is
> * returned and CMA will fail.
> */
> - if (strict && blockpfn < end_pfn)
> + if (strict && (blockpfn < end_pfn || total_isolated != nr_scanned))
> total_isolated = 0;
>
> cc->total_free_scanned += nr_scanned;
That's really old code. What userspace-visible effects might this
have? Is this from code inspection, or was some misbehaviour observed?
Thanks.