summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin
diff options
context:
space:
mode:
authorHui Zhu <zhuhui@kylinos.cn>2026-11-09 10:16:11 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-11-22 22:24:15 -0800
commit448293c44d86abaff45d6f6919e6056ad97eaa31 (patch)
treed5aa94aead3552ef3ee8284d56d5b1706d10e0b7 /tools/perf/scripts/python/bin
parentda48afefa78d358da74e7cef435e18c28451277a (diff)
mm/mglru: fix a no-op lru_gen_clear_refs() call in lru_lazyfree()
lru_lazyfree() calls lru_gen_clear_refs() after lruvec_del_folio(), but lru_gen_del_folio() has already cleared LRU_GEN_MASK, so folio_lru_gen() returns -1 and lru_gen_clear_refs() exits at its "gen < 0" check without clearing the refs or PG_workingset. A MADV_FREE folio therefore keeps the state it had before madvise(2), even though madvise_free_pte_range() has already cleared the accessed and dirty bits of its PTEs. lru_gen_folio_seq() places it one generation younger, and PG_workingset puts it in the last tier, so sort_folio() promotes and protects it instead of evicting it and charges it to lrugen->protected[], which read_ctrl_pos() uses to balance anon against file reclaim. __folio_inc_gen() clears the refs but not PG_workingset, so this repeats every time the folio reaches the oldest generation. If the folio is redirtied first, ttu_anon_lazyfree_folio() keeps it and lru_gen_eviction() packs the stale state into the shadow entry, so a later refault is promoted to the youngest generation. Call lru_gen_clear_refs() while the folio is still on the generation list, as deactivate_file_folio() and folio_deactivate() already do. Its return value only says whether the folio is in the oldest generation, which lru_lazyfree() does not need because it re-adds the folio below. Keep folio_clear_referenced() unconditional: the classic LRU needs it, and it also covers the folios that lru_gen_clear_refs() skips. Link: https://patch.msgid.link/20261109021611.22247-1-hui.zhu@linux.dev Fixes: cc8ec7be78ff ("mm/mglru: optimize deactivation") Signed-off-by: Hui Zhu <zhuhui@kylinos.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Suggested-by: Barry Song <baohua@kernel.org> Reviewed-by: Barry Song <baohua@kernel.org> Reviewed-by: Liam R. Howlett (Google) <liam@infradead.org> Cc: David Hildenbrand <david@kernel.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Yu Zhao <yuzhao@google.com> Cc: Kairui Song <kasong@tencent.com> Cc: <stable@vger.kernel.org> mm/folio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions