[PATCH] mm/mglru: restore accidentally removed seq < max_seq check
From: Barry Song (Xiaomi)
Date: Tue Sep 15 2026 - 06:27:56 EST
Since commit 798c0330c2ca ("mm/mglru: rework aging feedback"),
the following sanity check was accidentally removed:
if (seq < max_seq)
return 0;
That means we can perform aging for any value less than or equal to
max_gen_nr.
This has been inconsistent with
Documentation/admin-guide/mm/multigen_lru.rst, which states:
Users can write the following command to ``lru_gen`` to create a new
generation ``max_gen_nr+1``:
``+ memcg_id node_id max_gen_nr [can_swap [force_scan]]``
The correct semantics are that writing a value smaller than
max_gen_nr should return 0, since the requested generation already
exists.
Fixes: 798c0330c2ca ("mm/mglru: rework aging feedback")
Reported-by: Chuanhua Han <hanchuanhua802@xxxxxxxxx>
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/vmscan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5354eb8d3a07..18c4d3595749 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5827,6 +5827,9 @@ static int run_aging(struct lruvec *lruvec, unsigned long seq,
{
DEFINE_MAX_SEQ(lruvec);
+ if (seq < max_seq)
+ return 0;
+
if (seq > max_seq)
return -EINVAL;
--
2.39.3 (Apple Git-146)