mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kunwu Chan <kunwu.chan@gmail.com>
To: john <love_goo@163.com>
Cc: Kunwu Chan <kunwu.chan@gmail.com>,
	akpm@linux-foundation.org, liuye@kylinos.cn, hannes@cmpxchg.org,
	mhocko@kernel.org, david@kernel.org, ljs@kernel.org,
	hughd@google.com, mgorman@techsingularity.net,
	yang@os.amperecomputing.com, zhangqiuhao@huawei.com,
	wangkefeng.wang@huawei.com, mawupeng1@huwei.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Wupeng Ma <mawupeng1@huawei.com>
Subject: Re: [PATCH resend 2/2] mm: vmscan: stop scanning ineligible folios after max_nr_skipped
Date: Wed,  9 Sep 2026 17:56:28 +0800	[thread overview]
Message-ID: <20260909095629.2523075-1-kunwu.chan@gmail.com> (raw)
In-Reply-To: <20260901084706.3784449-3-love_goo@163.com>

On Tue,  1 Sep 2026 16:47:06 +0800 john <love_goo@163.com> wrote:

> From: Wupeng Ma <mawupeng1@huawei.com>
> 
> When reclaiming for a lower zone, isolate_lru_folios() accounts folios
> from higher zones as skipped and, once max_nr_skipped hits
> SWAP_CLUSTER_MAX_SKIPPED, force-isolates the remaining ineligible folios
> to keep the loop from spinning on the skipped ones.  Those folios are
> reclaimed even though they can never satisfy the current allocation, so
> nr_reclaimed is inflated into a false progress that keeps resetting
> no_progress_loops in should_reclaim_retry() and delays the OOM.
> 
> Stop scanning once max_nr_skipped is reached instead of force-isolating
> the ineligible folios.  The skipped folios are already accounted in
> total_scan, so shrink_lruvec() can charge the overshoot against its scan
> budget (see the previous commit) and will not rescan them.
> 
> Fixes: 1c7b17cf0594 ("mm/vmscan: fix hard LOCKUP in function isolate_lru_folios")
> Signed-off-by: Wupeng Ma <mawupeng1@huawei.com>
> ---
>  mm/vmscan.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 823af9e86efd3..375f7cd5aa441 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1701,12 +1701,20 @@ static unsigned long isolate_lru_folios(unsigned long nr_to_scan,
>  		nr_pages = folio_nr_pages(folio);
>  		total_scan += nr_pages;
>  
> -		/* Using max_nr_skipped to prevent hard LOCKUP*/
> -		if (max_nr_skipped < SWAP_CLUSTER_MAX_SKIPPED &&
> -		    (folio_zonenum(folio) > sc->reclaim_idx)) {
> +		/*
> +		 * Using max_nr_skipped to prevent hard LOCKUP.
> +		 * Once the cap is hit, stop rather than force-isolating:
> +		 * reclaiming ineligible folios only inflates nr_reclaimed
> +		 * into a false progress.
> +		 */
> +		if (folio_zonenum(folio) > sc->reclaim_idx) {
>  			nr_skipped[folio_zonenum(folio)] += nr_pages;
> -			move_to = &folios_skipped;
>  			max_nr_skipped++;
> +			if (max_nr_skipped >= SWAP_CLUSTER_MAX_SKIPPED) {
> +				list_move(&folio->lru, &folios_skipped);
> +				break;

One question about stopping the scan once max_nr_skipped reaches 
SWAP_CLUSTER_MAX_SKIPPED.

Previously, reaching this limit caused the remaining ineligible folios 
to be force-isolated so that the scanner would not keep looping on skipped 
folios. With this change, we break out of isolate_lru_folios() instead.

Could this cause us to stop before reaching eligible folios later in the LRU? 
Is SWAP_CLUSTER_MAX_SKIPPED intended to be sufficient to determine that 
continuing the scan cannot make useful reclaim progress?

Thanks,
KunWu

> +			}
> +			move_to = &folios_skipped;
>  			goto move;
>  		}
>  
> -- 
> 2.53.0
> 
> 

Sent using hkml (https://github.com/sjp38/hackermail)

  reply	other threads:[~2026-09-09  9:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  8:47 [PATCH resend 0/2] mm: vmscan: fix scan overshoot and ineligible folio scanning john
2026-09-01  8:47 ` [PATCH resend 1/2] mm: vmscan: charge isolate overshoot against scan quota john
2026-09-09  9:52   ` Kunwu Chan
2026-09-01  8:47 ` [PATCH resend 2/2] mm: vmscan: stop scanning ineligible folios after max_nr_skipped john
2026-09-09  9:56   ` Kunwu Chan [this message]
2026-09-08  1:49 ` [PATCH resend 0/2] mm: vmscan: fix scan overshoot and ineligible folio scanning john
2026-09-09  2:11 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909095629.2523075-1-kunwu.chan@gmail.com \
    --to=kunwu.chan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuye@kylinos.cn \
    --cc=ljs@kernel.org \
    --cc=love_goo@163.com \
    --cc=mawupeng1@huawei.com \
    --cc=mawupeng1@huwei.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yang@os.amperecomputing.com \
    --cc=zhangqiuhao@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®