Skip to content

Commit 6c24349

Browse files
author
Audra Mitchell
committed
mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats
JIRA: https://issues.redhat.com/browse/RHEL-104908 Conflicts: Minor context conflict due to missing two commits: 7eb2d01 ("mm/mglru: remove CONFIG_TRANSPARENT_HUGEPAGE") 61dd3f2 ("mm/mglru: add CONFIG_LRU_GEN_WALKS_MMU") This patch is a backport of the following upstream commit: commit ddd6d8e Author: Yu Zhao <[email protected]> Date: Sat Oct 19 01:29:38 2024 +0000 mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats Patch series "mm: multi-gen LRU: Have secondary MMUs participate in MM_WALK". Today, the MM_WALK capability causes MGLRU to clear the young bit from PMDs and PTEs during the page table walk before eviction, but MGLRU does not call the clear_young() MMU notifier in this case. By not calling this notifier, the MM walk takes less time/CPU, but it causes pages that are accessed mostly through KVM / secondary MMUs to appear younger than they should be. We do call the clear_young() notifier today, but only when attempting to evict the page, so we end up clearing young/accessed information less frequently for secondary MMUs than for mm PTEs, and therefore they appear younger and are less likely to be evicted. Therefore, memory that is *not* being accessed mostly by KVM will be evicted *more* frequently, worsening performance. ChromeOS observed a tab-open latency regression when enabling MGLRU with a setup that involved running a VM: Tab-open latency histogram (ms) Version p50 mean p95 p99 max base 1315 1198 2347 3454 10319 mglru 2559 1311 7399 12060 43758 fix 1119 926 2470 4211 6947 This series replaces the final non-selftest patchs from this series[1], which introduced a similar change (and a new MMU notifier) with KVM optimizations. I'll send a separate series (to Sean and Paolo) for the KVM optimizations. This series also makes proactive reclaim with MGLRU possible for KVM memory. I have verified that this functions correctly with the selftest from [1], but given that that test is a KVM selftest, I'll send it with the rest of the KVM optimizations later. Andrew, let me know if you'd like to take the test now anyway. [1]: https://lore.kernel.org/linux-mm/[email protected]/ This patch (of 2): The removed stats, MM_LEAF_OLD and MM_NONLEAF_TOTAL, are not very helpful and become more complicated to properly compute when adding test/clear_young() notifiers in MGLRU's mm walk. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: bd74fda ("mm: multi-gen LRU: support page table walks") Signed-off-by: Yu Zhao <[email protected]> Signed-off-by: James Houghton <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: David Matlack <[email protected]> Cc: David Rientjes <[email protected]> Cc: David Stevens <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Wei Xu <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Audra Mitchell <[email protected]>
1 parent 15dd52a commit 6c24349

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

include/linux/mmzone.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,7 @@ struct lru_gen_folio {
458458

459459
enum {
460460
MM_LEAF_TOTAL, /* total leaf entries */
461-
MM_LEAF_OLD, /* old leaf entries */
462461
MM_LEAF_YOUNG, /* young leaf entries */
463-
MM_NONLEAF_TOTAL, /* total non-leaf entries */
464462
MM_NONLEAF_FOUND, /* non-leaf entries found in Bloom filters */
465463
MM_NONLEAF_ADDED, /* non-leaf entries added to Bloom filters */
466464
NR_MM_STATS

mm/vmscan.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,7 +3320,6 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end,
33203320
continue;
33213321

33223322
if (!pte_young(ptent)) {
3323-
walk->mm_stats[MM_LEAF_OLD]++;
33243323
continue;
33253324
}
33263325

@@ -3479,7 +3478,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
34793478
walk->mm_stats[MM_LEAF_TOTAL]++;
34803479

34813480
if (!pmd_young(val)) {
3482-
walk->mm_stats[MM_LEAF_OLD]++;
34833481
continue;
34843482
}
34853483

@@ -3491,7 +3489,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
34913489
continue;
34923490
}
34933491
#endif
3494-
walk->mm_stats[MM_NONLEAF_TOTAL]++;
34953492

34963493
if (!walk->force_scan && should_clear_pmd_young()) {
34973494
if (!pmd_young(val))
@@ -5224,11 +5221,11 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
52245221
for (tier = 0; tier < MAX_NR_TIERS; tier++) {
52255222
seq_printf(m, " %10d", tier);
52265223
for (type = 0; type < ANON_AND_FILE; type++) {
5227-
const char *s = " ";
5224+
const char *s = "xxx";
52285225
unsigned long n[3] = {};
52295226

52305227
if (seq == max_seq) {
5231-
s = "RT ";
5228+
s = "RTx";
52325229
n[0] = READ_ONCE(lrugen->avg_refaulted[type][tier]);
52335230
n[1] = READ_ONCE(lrugen->avg_total[type][tier]);
52345231
} else if (seq == min_seq[type] || NR_HIST_GENS > 1) {
@@ -5247,14 +5244,14 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
52475244

52485245
seq_puts(m, " ");
52495246
for (i = 0; i < NR_MM_STATS; i++) {
5250-
const char *s = " ";
5247+
const char *s = "xxxx";
52515248
unsigned long n = 0;
52525249

52535250
if (seq == max_seq && NR_HIST_GENS == 1) {
5254-
s = "LOYNFA";
5251+
s = "TYFA";
52555252
n = READ_ONCE(lruvec->mm_state.stats[hist][i]);
52565253
} else if (seq != max_seq && NR_HIST_GENS > 1) {
5257-
s = "loynfa";
5254+
s = "tyfa";
52585255
n = READ_ONCE(lruvec->mm_state.stats[hist][i]);
52595256
}
52605257

0 commit comments

Comments
 (0)