All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Barry Song (Xiaomi)" <baohua@kernel.org>
To: akpm@linux-foundation.org
Cc: axelrasmussen@google.com, baohua@kernel.org,
	baoquan.he@linux.dev, david@kernel.org, hannes@cmpxchg.org,
	kasong@tencent.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, ljs@kernel.org, mhocko@kernel.org,
	qi.zheng@linux.dev, ridong.chen@linux.dev,
	shakeel.butt@linux.dev, weixugc@google.com, yuanchu@google.com,
	yuzhao@google.com, Chuanhua Han <hanchuanhua802@gmail.com>
Subject: [PATCH] mm/mglru: restore accidentally removed seq < max_seq check
Date: Tue, 15 Sep 2026 18:15:56 +0800	[thread overview]
Message-ID: <20260915101556.50467-1-baohua@kernel.org> (raw)

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@gmail.com>
Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org>
---
 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)



             reply	other threads:[~2026-09-15 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 10:15 Barry Song (Xiaomi) [this message]
2026-09-16  3:23 ` [PATCH] mm/mglru: restore accidentally removed seq < max_seq check Baolin Wang
2026-09-16  8:41 ` Kairui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915101556.50467-1-baohua@kernel.org \
    --to=baohua@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=hanchuanhua802@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=qi.zheng@linux.dev \
    --cc=ridong.chen@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.