Re: [PATCH mm-unstable v2 1/2] mm/vmscan: fix missing NR_ISOLATED counter update in MGLRU reclaim path
Baolin Wang <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <[email protected]> |
On 8/17/26 3:11 PM, Hui Zhu wrote: > From: Hui Zhu <[email protected]> > > 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 <[email protected]> > --- Changes look good to me with one nit below. Reviewed-by: Baolin Wang <[email protected]> > 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);