Skip to contentSkip to conversation

mm-vmscan-fix-missing-nr_isolated-counter-update-in-mglru-reclaim-path.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path
has been removed from the -mm tree. Its filename was
mm-vmscan-fix-missing-nr_isolated-counter-update-in-mglru-reclaim-path.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Hui Zhu <[email protected]>
Subject: mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path
Date: Wed, 14 Oct 2026 17:00:23 +0800

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.

---

 mm/vmscan.c |    5 +++++
 1 file changed, 5 insertions(+)
mm/vmscan.c renamed from mm/vmscan.c~mm-vmscan-fix-missing-nr_isolated-counter-update-in-mglru-reclaim-path +5 -0
@@ -5081,6 +5081,9 @@ static int evict_folios(unsigned long nr
 	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)
@@ -5149,6 +5152,8 @@ retry:
 		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);

_

Patches currently in -mm which might be from [email protected] are