The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Kairui Song <ryncsn@gmail.com>
To: Hui Zhu <hui.zhu@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Kairui Song <kasong@tencent.com>, Qi Zheng <qi.zheng@linux.dev>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Barry Song <baohua@kernel.org>,
	 Axel Rasmussen <axelrasmussen@google.com>,
	Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	David Hildenbrand <david@kernel.org>,
	 Michal Hocko <mhocko@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Hui Zhu <zhuhui@kylinos.cn>
Subject: Re: [PATCH] mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path
Date: Tue, 11 Aug 2026 23:16:05 +0800	[thread overview]
Message-ID: <anrPeDFIs6JoPqhj@KASONG-MC4> (raw)
In-Reply-To: <20260811071703.425097-1-hui.zhu@linux.dev>

On Tue, Aug 11, 2026 at 03:17:03PM +0800, Hui Zhu wrote:
> From: Hui Zhu <zhuhui@kylinos.cn>
> 
> The MGLRU evict_folios() isolates folios from the LRU without updating
> NR_ISOLATED_ANON/FILE counters, unlike the legacy shrink_inactive_list()
> path.
> This causes compaction's too_many_isolated() check and the OOMkiller to
> under-count isolated pages when MGLRU reclaim is active, potentially
> leading to unnecessary compaction attempts or incorrect OOM decisions
> under memory pressure.

This patch still doesn't cover the OOM problem, too_many_isolated is not
used for MGLRU. I prefer to keep unifying them like what we did previously
with writeback.

It might work for compaction though, did you test it?

> 
> Add NR_ISOLATED counter updates in evict_folios(): increment after
> isolate_folios() and decrement after all retry passes complete, using
> the original isolated count saved before retry.
> 
> Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>
> ---
>  mm/vmscan.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index bc324e37c5f1..723b513574b3 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -4817,6 +4817,7 @@ static int evict_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
>  	struct lru_gen_mm_walk *walk;
>  	int scanned, reclaimed;
>  	int isolated = 0, type, type_scanned;
> +	int isolated_orig = 0;

The variable name looks a bit confusing, and what is your based commit?
In latest mm-unstable there is already a nr_isolated you can use.

  reply	other threads:[~2026-08-11 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  7:17 [PATCH] mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path Hui Zhu
2026-08-11 15:16 ` Kairui Song [this message]
2026-08-12  3:11   ` Hui Zhu

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=anrPeDFIs6JoPqhj@KASONG-MC4 \
    --to=ryncsn@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hui.zhu@linux.dev \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=qi.zheng@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=zhuhui@kylinos.cn \
    /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