From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E188281503 for ; Tue, 18 Aug 2026 03:19:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787023192; cv=none; b=Z4x7KlWqqYcP/EkftZr20cU5Qff54j0zby5na3yq2ueR/2YUIxYOd42L1xQArWPSrnR/SlSD1u2SoidXB99snnBkPIetd+8voqJEQo/+nVs2p6CAHJaRqCZIUtZXQCUfTl3OrTt2bRTQOEfrjB3pHgxjiSpBd/hmW/xQsz1zRVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787023192; c=relaxed/simple; bh=VrxCbO6aDGDwy2ATD3DRxGcLNCxynANmIBP1HvIfLYY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oBDhntyj2wX/1tQN2pStASGVs/TbFv8uvPxn7mQIuQbAgVcDm7LIxX5uS50o28bKFee6ZAvRZqsIinwnSENXotvO+F1NbptdsJhRjpYcBFhGLnxiS3OkzathLh2RMdqvj3U2DDMKCN35A8M7ogmT00Fl+3E2BuXJ7xBkVGMBwwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=eD7wrUBj; arc=none smtp.client-ip=115.124.30.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="eD7wrUBj" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1787023181; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=7J/Uduy/xE+C4LP4mB+3ZctUtQysnqQkKDdtyXBHTxo=; b=eD7wrUBj979EC2sdFwe8ndkeh9RFJiQ9LjW+QirsffKzVQUSfUw+P77GDHQzm0ej1Z9aQrgnIWUTDODhFjYV4H7XGLadDAOliUOHllZ5PCb6mtgUrxpPGEUOPHS3tuZ9g7rljGKGUl7A/GFE1cdk8gndk+u1gp6btggaBJ6FKD4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045133197;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0X9BvS.-_1787023179; Received: from 30.74.144.114(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X9BvS.-_1787023179 cluster:ay36) by smtp.aliyun-inc.com; Tue, 18 Aug 2026 11:19:40 +0800 Message-ID: <7e99b10a-183c-446b-9fbe-8db8cfc0acca@linux.alibaba.com> Date: Tue, 18 Aug 2026 11:19:39 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH mm-unstable v2 1/2] mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path To: Hui Zhu , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Hui Zhu References: <9635d3c027bb8a5a416df04ea891a482beb3de9e.1786950138.git.zhuhui@kylinos.cn> From: Baolin Wang In-Reply-To: <9635d3c027bb8a5a416df04ea891a482beb3de9e.1786950138.git.zhuhui@kylinos.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/17/26 3:11 PM, Hui Zhu wrote: > From: Hui Zhu > > MGLRU evict_folios() isolates folios from the LRU without updating > the NR_ISOLATED_ANON/FILE counters, unlike the legacy > shrink_inactive_list() path. This causes compaction's > too_many_isolated() check to under-count isolated pages when MGLRU > reclaim is active. > > Add NR_ISOLATED counter updates in evict_folios(): increment after > isolate_folios() and decrement after all retry passes complete, using > the existing nr_isolated which holds the original isolated count. > > Signed-off-by: Hui Zhu > --- Changes look good to me with one nit below. Reviewed-by: Baolin Wang > mm/vmscan.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index c1404a59523d..fdc45d7d8fba 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4892,6 +4892,9 @@ static int evict_folios(unsigned long nr_to_scan, struct lruvec *lruvec, > scanned = isolate_folios(nr_to_scan, lruvec, sc, swappiness, > &list, &isolated, &type, &type_scanned); > nr_isolated = isolated; > + if (nr_isolated) > + __mod_node_page_state(pgdat, NR_ISOLATED_ANON + type, > + nr_isolated); > > /* Scanning may have emptied the oldest gen, flush it */ > if (scanned) > @@ -4954,6 +4957,10 @@ static int evict_folios(unsigned long nr_to_scan, struct lruvec *lruvec, > goto retry; > } > > + if (nr_isolated) Nit: we can remove this check, since we never reach here if nr_isolated is 0. > + mod_node_page_state(pgdat, NR_ISOLATED_ANON + type, > + -nr_isolated); > + > if (nr_isolated > total_reclaimed) > mod_lruvec_state(lruvec, PGROTATE_ANON + type, > nr_isolated - total_reclaimed);