From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-21.mta0.migadu.com [91.218.175.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E6D33A5453 for ; Fri, 18 Sep 2026 08:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789718873; cv=none; b=kylX+G71cG+a1juRCMld60nDsYDWbmbMDTHl6L45NYLkZiFx3Zdcr1rQ7hapPZghunkPK1vgXKBIMp74tfwOdaWnNDwVenTSO3Rbkk//hnB4O90aUnXu2vFM4oYMIMdhCYgN5tDg05ZiZg5P6GE6GXRJvWgitZoqAFo7V0hU5Uw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789718873; c=relaxed/simple; bh=LQKsApWiukLe6I05VRgMX+vmqCliXhSA5N9TndfGCbw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AY86pmOc+Z4JmwVuD4nmFPWa4md91coBt9gX+I9vnzKk8sZMo/DlVkEkU0iTnarwCM20n4JskidPvcqJ5ONimAdzKnBWpN6nnqaUANQ7XFuG0JxfPm2yCkrFh0yupbGW1WW30/TUipmvrMsObJjmsR42tDsv4oABpGGCTC8/Wvw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=v0ypuYY9; arc=none smtp.client-ip=91.218.175.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="v0ypuYY9" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=LQKsApWiukLe6I05VRgMX+vmqCliXhSA5N9TndfGCbw=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789718869; v=1; x=1790323669; b=v0ypuYY9lpx+Q4GIVdm9v6zwBXNzKPoIF0AcrTD769tsD+Zkub1VTe4r/3Mpqz+pZRxmbi6M 3w84Fi25B4W5b/cYPhUxk6VSpSIewtFSefFIwsVo23kWlBIb2mH8kLg6pBFhMzJw3r1yRNaakVg Rw7IoYWVYJvizNE5Orr8C3vE= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta11.migadu.com with ESMTPS id 38739c2bf71cf7dd; Fri, 18 Sep 2026 08:07:49 +0000 X-Mizu-Trace-ID: 38739c2bf71cf7dd X-Migadu-Flow: FLOW_OUT From: Hui Zhu To: Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Baolin Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Hui Zhu Subject: [RFC PATCH RESEND v5 1/2] mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path Date: Fri, 18 Sep 2026 16:07:19 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Baolin Wang Reviewed-by: Barry Song --- mm/vmscan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index f11491ee9ed5..3936c553c63b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4897,6 +4897,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) @@ -4959,6 +4962,8 @@ static int evict_folios(unsigned long nr_to_scan, struct lruvec *lruvec, goto retry; } + 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); -- 2.43.0