Re: [PATCH v2 2/2] mm/mglru: make retry logic explicit in isolate_folios()

From: Baoquan He

Date: Thu Sep 03 2026 - 03:54:48 EST


On 09/03/26 at 03:05pm, Barry Song (Xiaomi) wrote:
> On Thu, Sep 3, 2026 at 9:27 AM Baoquan He <baoquan.he@xxxxxxxxx> wrote:
> >
> [...]
> >
> > Thanks, Barry. These number is very convincing. The retry for swappiness
> > 0 is worthy. Then the patchset feels like doing two things: refactoring
> > the for() loop; improving the eviction for swappiness 0/201 by adding a
> > retry and this also makes them be consistent with (1, 200). While the
> > cover letter subject, patch 1 and patch 2 feels like it's not easy to
> > match them to the corresponding part. Maybe merging them to one patch,
> > or rearranging them? Just personal opinion.
> >
>
> Hi Baoquan,
>
> Thanks very much for your suggestions and review.
> We have two patches:
>
> 1. `mm/mglru: make type fallback logic explicit in isolate_folios()`
> 2. `mm/mglru: make retry logic explicit in isolate_folios()`
>
> One handles fallback, while the other handles retry. I think this
> separation makes the logic clearer. Could we keep the current
> separation?

Yeah, it's also fine to me. Thanks for the effort.

>
> But we may really need Andrew's kind help to squash the change
> you found below:
>
>
> From 1fb8046662a8b23be1b87a21cc9964e9ff9e1eb0 Mon Sep 17 00:00:00 2001
> From: "Barry Song (Xiaomi)" <baohua@xxxxxxxxxx>
> Date: Thu, 3 Sep 2026 14:48:52 +0800
> Subject: [PATCH] mm: revert slight behavior change for swappiness 1-200
>
> Baoquan's review found that we unexpectedly introduced a slight behavior
> change for swappiness 1-200. We could now have a case like:
>
> 1. First scan -> `scanned != 0`
> 2. Second scan -> `scanned = 0`
> 3. Type fallback
>
> Step 3 was impossible before. Let's remove this possibility.
>
> Reported-by: Baoquan He <baoquan.he@xxxxxxxxx>
> Closes: https://lore.kernel.org/linux-mm/apfZQE1X6zGAsBb_@fedora/
> Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
> ---
> mm/vmscan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index bf2786c7247d..ba7adf36e69f 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -4939,7 +4939,7 @@ static int isolate_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
> * We are running out of the current reclaim type. Fall back to
> * the other type if allowed.
> */
> - if (!scanned && type_fallback_allowed) {
> + if (!scanned && !tried && type_fallback_allowed) {
> type = !type;
> tried = true;
> type_fallback_allowed = false;
> --
> 2.39.3 (Apple Git-146)
>