[PATCH 1/2] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats

James Houghton posted 2 patches 1 month, 1 week ago
[PATCH 1/2] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats
Posted by James Houghton 1 month, 1 week ago
From: Yu Zhao <yuzhao@google.com>

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.

Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: James Houghton <jthoughton@google.com>
---
 include/linux/mmzone.h |  2 --
 mm/vmscan.c            | 14 +++++---------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 96dea31fb211..691c635d8d1f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -460,9 +460,7 @@ struct lru_gen_folio {
 
 enum {
 	MM_LEAF_TOTAL,		/* total leaf entries */
-	MM_LEAF_OLD,		/* old leaf entries */
 	MM_LEAF_YOUNG,		/* young leaf entries */
-	MM_NONLEAF_TOTAL,	/* total non-leaf entries */
 	MM_NONLEAF_FOUND,	/* non-leaf entries found in Bloom filters */
 	MM_NONLEAF_ADDED,	/* non-leaf entries added to Bloom filters */
 	NR_MM_STATS
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2d0486189804..60669f8bba46 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3405,7 +3405,6 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end,
 			continue;
 
 		if (!pte_young(ptent)) {
-			walk->mm_stats[MM_LEAF_OLD]++;
 			continue;
 		}
 
@@ -3558,7 +3557,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
 			walk->mm_stats[MM_LEAF_TOTAL]++;
 
 			if (!pmd_young(val)) {
-				walk->mm_stats[MM_LEAF_OLD]++;
 				continue;
 			}
 
@@ -3570,8 +3568,6 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end,
 			continue;
 		}
 
-		walk->mm_stats[MM_NONLEAF_TOTAL]++;
-
 		if (!walk->force_scan && should_clear_pmd_young()) {
 			if (!pmd_young(val))
 				continue;
@@ -5262,11 +5258,11 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
 	for (tier = 0; tier < MAX_NR_TIERS; tier++) {
 		seq_printf(m, "            %10d", tier);
 		for (type = 0; type < ANON_AND_FILE; type++) {
-			const char *s = "   ";
+			const char *s = "xxx";
 			unsigned long n[3] = {};
 
 			if (seq == max_seq) {
-				s = "RT ";
+				s = "RTx";
 				n[0] = READ_ONCE(lrugen->avg_refaulted[type][tier]);
 				n[1] = READ_ONCE(lrugen->avg_total[type][tier]);
 			} else if (seq == min_seq[type] || NR_HIST_GENS > 1) {
@@ -5288,14 +5284,14 @@ static void lru_gen_seq_show_full(struct seq_file *m, struct lruvec *lruvec,
 
 	seq_puts(m, "                      ");
 	for (i = 0; i < NR_MM_STATS; i++) {
-		const char *s = "      ";
+		const char *s = "xxxx";
 		unsigned long n = 0;
 
 		if (seq == max_seq && NR_HIST_GENS == 1) {
-			s = "LOYNFA";
+			s = "TYFA";
 			n = READ_ONCE(mm_state->stats[hist][i]);
 		} else if (seq != max_seq && NR_HIST_GENS > 1) {
-			s = "loynfa";
+			s = "tyfa";
 			n = READ_ONCE(mm_state->stats[hist][i]);
 		}
 
-- 
2.47.0.105.g07ac214952-goog
Re: [PATCH 1/2] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats
Posted by Andrew Morton 1 month ago
On Sat, 19 Oct 2024 01:29:38 +0000 James Houghton <jthoughton@google.com> wrote:

> From: Yu Zhao <yuzhao@google.com>
> 
> 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.
> 

Patch 2/2 has Fixes: and cc:stable.  Patch 2/2 requires patch 1/2.  So I
added the same Fixes: and cc:stable to patch 1/2.
Re: [PATCH 1/2] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats
Posted by Yu Zhao 1 month ago
On Wed, Oct 23, 2024 at 9:26 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Sat, 19 Oct 2024 01:29:38 +0000 James Houghton <jthoughton@google.com> wrote:
>
> > From: Yu Zhao <yuzhao@google.com>
> >
> > 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.
> >
>
> Patch 2/2 has Fixes: and cc:stable.  Patch 2/2 requires patch 1/2.  So I
> added the same Fixes: and cc:stable to patch 1/2.

SGTM. Thanks!