mm/mglru: fix a few reclaim issues
Subsystems (4)
Barry Song (Xiaomi)
reviewercover mm/mglru: fix a few reclaim issues
This series contains three MGLRU fixes originally proposed by Chris Mason and passed on to us by David Hildenbrand.
The issues addressed are:
1. Reparented folios becoming unreclaimable due to generation accounting falling outside the parent's [min_seq, max_seq] range.
2. A potential deadlock between reclaim and compaction when isolating folios.
3. Missing vmpressure notifications for global reclaim on cgroup v1.
Kairui and I have reviewed the fixes and made minor adjustments where necessary.
The series is based on mm-new.
Chris Mason (3):
mm/mglru: count all generations as evictable mm/mglru: test PG_lru before taking a folio reference mm/mglru: report root reclaim to memory.pressure_level
mm/vmscan.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.3 (Apple Git-146)
Barry Song (Xiaomi)
reviewerPATCH 1/3 mm/mglru: count all generations as evictable
From: Chris Mason <[email protected]>
With MGLRU enabled, clean page cache that was reparented from a removed memory cgroup can stay unreclaimable for as long as the parent has no other evictable folios on the same node.
try_to_shrink_lruvec() derives its scan count from lruvec_evictable_size(), and with a count of 0 it runs neither eviction nor aging. lruvec_evictable_size() adds up nr_pages[] only for the generations from min_seq to max_seq. That sum is complete only if the count of a generation is 0 by the time min_seq advances past it.
But try_to_inc_min_seq() ignores the counts: it advances min_seq past a generation as soon as the lists of that generation are empty. A folio that folio_update_gen() promoted is counted in its new generation, but stays on the list of the generation that it came from. Normally min_seq stops at that list, before it reaches the new generation.
Reparenting moves each list and each count to the same index in the parent, where that index can stand for a different age:
index (seq % MAX_NR_GENS) 0 1 2 3
seq in the child 0 1 2 3
seq in the parent 4 5 6 3 folio F: on folios[0], counted in nr_pages[3]
child: folios[0] holds min_seq at 0
parent: folios[3] is empty, so min_seq goes from 3 to 4
sum: nr_pages[0] + nr_pages[1] + nr_pages[2] = 0, without FThe fix used here is to add up nr_pages[] of all MAX_NR_GENS generations in lruvec_evictable_size().
--- mm/vmscan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
mm/vmscan.c +6 -3
@@ -4272,8 +4272,6 @@ static void lruvec_evictable_size(struct lruvec *lruvec, struct scan_control *scstruct lru_gen_folio *lrugen = &lruvec->lrugen;struct mem_cgroup *memcg =lruvec_memcg (lruvec);int nid =lruvec_pgdat (lruvec)->node_id; -DEFINE_MAX_SEQ (lruvec); -DEFINE_MIN_SEQ (lruvec); nr[LRU_GEN_ANON ] =0 ; nr[LRU_GEN_FILE ] =0 ;
@@ -4281,7 +4279,12 @@ static void lruvec_evictable_size(struct lruvec *lruvec, struct scan_control *scfor_each_evictable_type (type, swappiness) {if (type ==LRU_GEN_ANON && !can_reclaim_anon_pages (memcg, nid, sc))continue ; -for (seq = min_seq[type]; seq <= max_seq; seq++) +/* +* Reparenting can leave folios accounted for in +* generations outside [min_seq, max_seq]. Count +* them as well to ensure reclaim makes progress. +*/ +for (seq =0 ; seq <MAX_NR_GENS ; seq++) nr[type] +=lruvec_gen_size (lrugen, type, seq, max_zone); } }
Signature · 1 line
2.39.3 (Apple Git-146)
+ mm-mglru-count-all-generations-as-evictable.patch added to mm-new branch
The patch titled Subject: mm/mglru: count all generations as evictable has been added to the -mm mm-new branch. Its filename is mm-mglru-count-all-generations-as-evictable.patch
The patch titled
Subject: mm/mglru: count all generations as evictable
has been added to the -mm mm-new branch. Its filename is
mm-mglru-count-all-generations-as-evictable.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mglru-count-all-generations-as-evictable.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Chris Mason <[email protected]>
Subject: mm/mglru: count all generations as evictable
Date: Sun, 29 Nov 2026 22:37:57 +0800
Patch series "mm/mglru: fix a few reclaim issues".
This series contains three MGLRU fixes originally proposed by Chris Mason and passed on to us by David Hildenbrand.
The issues addressed are:
1. Reparented folios becoming unreclaimable due to generation accounting falling outside the parent's [min_seq, max_seq] range.
2. A potential deadlock between reclaim and compaction when isolating folios.
3. Missing vmpressure notifications for global reclaim on cgroup v1.
Kairui and I have reviewed the fixes and made minor adjustments where necessary.
The series is based on mm-new.
This patch (of 3):
With MGLRU enabled, clean page cache that was reparented from a removed memory cgroup can stay unreclaimable for as long as the parent has no other evictable folios on the same node.
try_to_shrink_lruvec() derives its scan count from lruvec_evictable_size(), and with a count of 0 it runs neither eviction nor aging. lruvec_evictable_size() adds up nr_pages[] only for the generations from min_seq to max_seq. That sum is complete only if the count of a generation is 0 by the time min_seq advances past it.
But try_to_inc_min_seq() ignores the counts: it advances min_seq past a generation as soon as the lists of that generation are empty. A folio that folio_update_gen() promoted is counted in its new generation, but stays on the list of the generation that it came from. Normally min_seq stops at that list, before it reaches the new generation.
Reparenting moves each list and each count to the same index in the parent, where that index can stand for a different age:
index (seq % MAX_NR_GENS) 0 1 2 3
seq in the child 0 1 2 3
seq in the parent 4 5 6 3 folio F: on folios[0], counted in nr_pages[3]
child: folios[0] holds min_seq at 0
parent: folios[3] is empty, so min_seq goes from 3 to 4
sum: nr_pages[0] + nr_pages[1] + nr_pages[2] = 0, without FThe fix used here is to add up nr_pages[] of all MAX_NR_GENS generations in lruvec_evictable_size().
mm/vmscan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
mm/vmscan.c renamed from mm/vmscan.c~mm-mglru-count-all-generations-as-evictable +6 -3
@@ -4272,8 +4272,6 @@ static void lruvec_evictable_size(structstruct lru_gen_folio *lrugen = &lruvec->lrugen;struct mem_cgroup *memcg =lruvec_memcg (lruvec);int nid =lruvec_pgdat (lruvec)->node_id; -DEFINE_MAX_SEQ (lruvec); -DEFINE_MIN_SEQ (lruvec); nr[LRU_GEN_ANON ] =0 ; nr[LRU_GEN_FILE ] =0 ;
@@ -4281,7 +4279,12 @@ static void lruvec_evictable_size(structfor_each_evictable_type (type, swappiness) {if (type ==LRU_GEN_ANON && !can_reclaim_anon_pages (memcg, nid, sc))continue ; -for (seq = min_seq[type]; seq <= max_seq; seq++) +/* +* Reparenting can leave folios accounted for in +* generations outside [min_seq, max_seq]. Count +* them as well to ensure reclaim makes progress. +*/ +for (seq =0 ; seq <MAX_NR_GENS ; seq++) nr[type] +=lruvec_gen_size (lrugen, type, seq, max_zone); } }
_
Patches currently in -mm which might be from [email protected] are
mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch
Re: [PATCH 1/3] mm/mglru: count all generations as evictable
In reply to Barry Song (Xiaomi)Quoted 33 lines · Barry Song (Xiaomi)
From: Chris Mason <[email protected]>
With MGLRU enabled, clean page cache that was reparented from a removed memory cgroup can stay unreclaimable for as long as the parent has no other evictable folios on the same node.
try_to_shrink_lruvec()derives its scan count fromlruvec_evictable_size(), and with a count of 0 it runs neither eviction nor aging.lruvec_evictable_size()adds up nr_pages[] only for the generations frommin_seqtomax_seq. That sum is complete only if the count of a generation is 0 by the timemin_seqadvances past it.But
try_to_inc_min_seq()ignores the counts: it advancesmin_seqpast a generation as soon as the lists of that generation are empty. A folio thatfolio_update_gen()promoted is counted in its new generation, but stays on the list of the generation that it came from. Normallymin_seqstops at that list, before it reaches the new generation.Reparenting moves each list and each count to the same index in the parent, where that index can stand for a different age:
index (seq % MAX_NR_GENS) 0 1 2 3 seq in the child 0 1 2 3 seq in the parent 4 5 6 3folio F: on folios[0], counted in nr_pages[3] child: folios[0] holds min_seq at 0 parent: folios[3] is empty, so min_seq goes from 3 to 4 sum: nr_pages[0] + nr_pages[1] + nr_pages[2] = 0, without FThe fix used here is to add up nr_pages[] of all
MAX_NR_GENSgenerations inlruvec_evictable_size().
Quoted 6 lines
Fixes 163bc3d68c9f ("mm/mglru: restructure the reclaim loop")Signed-off-by Chris Mason <[email protected]>Signed-off-by David Hildenbrand (Arm) <[email protected]>[Barry: Rebased onto mm-new and added comments]Signed-off-by Barry Song (Xiaomi) <[email protected]>---
LGTM.
Barry Song (Xiaomi)
reviewerPATCH 2/3 mm/mglru: test PG_lru before taking a folio reference
In reply to Barry Song (Xiaomi)From: Chris Mason <[email protected]>
With MGLRU, reclaim that races with compaction for a folio can deadlock on the lruvec->lru_lock that it already holds.
isolate_folio() runs under the lru_lock. It takes a reference, and drops it again if another isolator has already cleared PG_lru. That folio_put() must not be the last one, since the free path takes the lru_lock if PG_lru is set. But compaction can release the lru_lock while the folio is still on the list with PG_lru clear. If the folio is truncated or unmapped meanwhile, the two isolators hold the only references:
isolate_migratepages_block() evict_folios()
============================ ==============
folio_get_nontail_page()
folio_test_clear_lru()
goto isolate_abort
lruvec_unlock_irqrestore()
lruvec_lock_irq()
isolate_folio()
folio_try_get()
folio_test_clear_lru() fails
folio_set_lru()
folio_put()
folio_put()
__page_cache_release()
folio_lruvec_lock_irqsave()The fix used here is to leave a folio alone if PG_lru is already clear, before a reference is taken, as isolate_lru_folios() does. An isolator that clears PG_lru after that test has to take the lru_lock before it drops its own reference.
--- mm/vmscan.c | 9 +++++++++ 1 file changed, 9 insertions(+)
mm/vmscan.c +9 -0
@@ -4802,6 +4802,15 @@ static bool isolate_folio(struct lruvec *lruvec, struct folio *folio, struct sca {bool success; +/* +* If PG_lru is set, the folio_put() below can't be the last one and +* free the folio: whoever clears the flag keeps its reference until +* it sets the flag again or takes the folio off the list, and it has +* to take the lru_lock we hold before it can do either. +*/ +if (!folio_test_lru (folio)) +return false; +/* raced with release_pages() */ if (!folio_try_get (folio))return false;
Signature · 1 line
2.39.3 (Apple Git-146)
+ mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch added to mm-new branch
The patch titled Subject: mm/mglru: test PG_lru before taking a folio reference has been added to the -mm mm-new branch. Its filename is mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch
The patch titled
Subject: mm/mglru: test PG_lru before taking a folio reference
has been added to the -mm mm-new branch. Its filename is
mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Chris Mason <[email protected]>
Subject: mm/mglru: test PG_lru before taking a folio reference
Date: Sun, 29 Nov 2026 22:37:58 +0800
With MGLRU, reclaim that races with compaction for a folio can deadlock on the lruvec->lru_lock that it already holds.
isolate_folio() runs under the lru_lock. It takes a reference, and drops it again if another isolator has already cleared PG_lru. That folio_put() must not be the last one, since the free path takes the lru_lock if PG_lru is set. But compaction can release the lru_lock while the folio is still on the list with PG_lru clear. If the folio is truncated or unmapped meanwhile, the two isolators hold the only references:
isolate_migratepages_block() evict_folios()
============================ ==============
folio_get_nontail_page()
folio_test_clear_lru()
goto isolate_abort
lruvec_unlock_irqrestore()
lruvec_lock_irq()
isolate_folio()
folio_try_get()
folio_test_clear_lru() fails
folio_set_lru()
folio_put()
folio_put()
__page_cache_release()
folio_lruvec_lock_irqsave()The fix used here is to leave a folio alone if PG_lru is already clear, before a reference is taken, as isolate_lru_folios() does. An isolator that clears PG_lru after that test has to take the lru_lock before it drops its own reference.
mm/vmscan.c | 9 +++++++++ 1 file changed, 9 insertions(+)
mm/vmscan.c renamed from mm/vmscan.c~mm-mglru-test-pg_lru-before-taking-a-folio-reference +9 -0
@@ -4802,6 +4802,15 @@ static bool isolate_folio(struct lruvec {bool success; +/* +* If PG_lru is set, the folio_put() below can't be the last one and +* free the folio: whoever clears the flag keeps its reference until +* it sets the flag again or takes the folio off the list, and it has +* to take the lru_lock we hold before it can do either. +*/ +if (!folio_test_lru (folio)) +return false; +/* raced with release_pages() */ if (!folio_try_get (folio))return false;
_
Patches currently in -mm which might be from [email protected] are
mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch
Re: [PATCH 2/3] mm/mglru: test PG_lru before taking a folio reference
In reply to Barry Song (Xiaomi)Quoted 34 lines · Barry Song (Xiaomi)
From: Chris Mason <[email protected]>
With MGLRU, reclaim that races with compaction for a folio can deadlock on the
lruvec->lru_lockthat it already holds.
isolate_folio()runs under thelru_lock. It takes a reference, and drops it again if another isolator has already clearedPG_lru. Thatfolio_put()must not be the last one, since the free path takes thelru_lockifPG_lruis set. But compaction can release thelru_lockwhile the folio is still on the list withPG_lruclear. If the folio is truncated or unmapped meanwhile, the two isolators hold the only references:isolate_migratepages_block() evict_folios() ============================ ============== folio_get_nontail_page() folio_test_clear_lru() goto isolate_abort lruvec_unlock_irqrestore() lruvec_lock_irq() isolate_folio() folio_try_get() folio_test_clear_lru() fails folio_set_lru() folio_put() folio_put() __page_cache_release() folio_lruvec_lock_irqsave()The fix used here is to leave a folio alone if
PG_lruis already clear, before a reference is taken, asisolate_lru_folios()does. An isolator that clearsPG_lruafter that test has to take thelru_lockbefore it drops its own reference.
Quoted 8 lines
Fixes ac35a4902374 ("mm: multi-gen LRU: minimal implementation")Signed-off-by Chris Mason <[email protected]>Signed-off-by David Hildenbrand (Arm) <[email protected]>[Kairui: Improved the comment]Signed-off-by Kairui Song <[email protected]>Signed-off-by Barry Song (Xiaomi) <[email protected]>---
LGTM.
Barry Song (Xiaomi)
reviewerPATCH 3/3 mm/mglru: report root reclaim to memory.pressure_level
In reply to Barry Song (Xiaomi)From: Chris Mason <[email protected]>
With MGLRU enabled, memory.pressure_level listeners on the cgroup v1 root can miss global reclaim: kswapd sends them no events, and direct reclaim only "critical" ones.
On v1 the eventfds are only fed by vmpressure() calls with tree=true. shrink_node() makes that call after walking the memcgs, but it hands root reclaim to lru_gen_shrink_node() and returns first. The MGLRU walk only calls vmpressure() from shrink_one(), with tree=false, which has no consumer on v1. That leaves vmpressure_prio() in direct reclaim.
The fix used here is to make the same subtree report at the end of the MGLRU walk of a node.
Listeners for "medium" and "critical" can miss events they got before, since a vmpressure_prio() report is now averaged with the pages that the walk freed in the same window.
--- mm/vmscan.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/vmscan.c +6 -0
@@ -5511,6 +5511,7 @@ static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *scstatic void lru_gen_shrink_node (struct pglist_data *pgdat,struct scan_control *sc) {struct blk_plug plug; +unsigned long scanned = sc->nr_scanned;unsigned long reclaimed = sc->nr_reclaimed;VM_WARN_ON_ONCE (!root_reclaim (sc));
@@ -5545,6 +5546,11 @@ static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *clear_mm_walk ();blk_finish_plug (&plug); + +/* Record the subtree's reclaim efficiency */ +if (!sc->proactive) +vmpressure (sc->gfp_mask, sc->order, sc->target_mem_cgroup, true, + sc->nr_scanned - scanned, sc->nr_reclaimed - reclaimed); done:if (sc->nr_reclaimed > reclaimed)kswapd_try_clear_hopeless (pgdat, sc->order, sc->reclaim_idx);
Signature · 1 line
2.39.3 (Apple Git-146)
+ mm-mglru-report-root-reclaim-to-memorypressure_level.patch added to mm-new branch
The patch titled Subject: mm/mglru: report root reclaim to memory.pressure_level has been added to the -mm mm-new branch. Its filename is mm-mglru-report-root-reclaim-to-memorypressure_level.patch
The patch titled
Subject: mm/mglru: report root reclaim to memory.pressure_level
has been added to the -mm mm-new branch. Its filename is
mm-mglru-report-root-reclaim-to-memorypressure_level.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mglru-report-root-reclaim-to-memorypressure_level.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Chris Mason <[email protected]>
Subject: mm/mglru: report root reclaim to memory.pressure_level
Date: Sun, 29 Nov 2026 22:37:59 +0800
With MGLRU enabled, memory.pressure_level listeners on the cgroup v1 root can miss global reclaim: kswapd sends them no events, and direct reclaim only "critical" ones.
On v1 the eventfds are only fed by vmpressure() calls with tree=true. shrink_node() makes that call after walking the memcgs, but it hands root reclaim to lru_gen_shrink_node() and returns first. The MGLRU walk only calls vmpressure() from shrink_one(), with tree=false, which has no consumer on v1. That leaves vmpressure_prio() in direct reclaim.
The fix used here is to make the same subtree report at the end of the MGLRU walk of a node.
Listeners for "medium" and "critical" can miss events they got before, since a vmpressure_prio() report is now averaged with the pages that the walk freed in the same window.
mm/vmscan.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/vmscan.c renamed from mm/vmscan.c~mm-mglru-report-root-reclaim-to-memorypressure_level +6 -0
@@ -5511,6 +5511,7 @@ static void lru_gen_shrink_lruvec(structstatic void lru_gen_shrink_node (struct pglist_data *pgdat,struct scan_control *sc) {struct blk_plug plug; +unsigned long scanned = sc->nr_scanned;unsigned long reclaimed = sc->nr_reclaimed;VM_WARN_ON_ONCE (!root_reclaim (sc));
@@ -5545,6 +5546,11 @@ static void lru_gen_shrink_node(struct pclear_mm_walk ();blk_finish_plug (&plug); + +/* Record the subtree's reclaim efficiency */ +if (!sc->proactive) +vmpressure (sc->gfp_mask, sc->order, sc->target_mem_cgroup, true, + sc->nr_scanned - scanned, sc->nr_reclaimed - reclaimed); done:if (sc->nr_reclaimed > reclaimed)kswapd_try_clear_hopeless (pgdat, sc->order, sc->reclaim_idx);
_
Patches currently in -mm which might be from [email protected] are
mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch
Quoted 17 lines · Barry Song (Xiaomi)
This series contains three MGLRU fixes originally proposed by Chris Mason and passed on to us by David Hildenbrand.
The issues addressed are:
1. Reparented folios becoming unreclaimable due to generation accounting falling outside the parent's [
min_seq,max_seq] range.
2. A potential deadlock between reclaim and compaction when isolating folios.
3. Missing vmpressure notifications for global reclaim on cgroup v1.Kairui and I have reviewed the fixes and made minor adjustments where necessary.
The series is based on mm-new.
Quoted 7 lines
Chris Mason (3):
mm/mglru: count all generations as evictable mm/mglru: testPG_lrubefore taking a folio reference mm/mglru: report root reclaim to memory.pressure_levelmm/vmscan.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
Thanks Barry!
These commits are valid bugfixes and in good shape, so: