Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <baoquan.he@linux.dev>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, kasong@tencent.com, baohua@kernel.org,
	qi.zheng@linux.dev, shakeel.butt@linux.dev, baoquan.he@linux.dev,
	baolin.wang@linux.alibaba.com, hannes@cmpxchg.org,
	mhocko@kernel.org, Baoquan He <hebaoquan@kylinos.cn>
Subject: [PATCH 2/4] mm/mglru: rename positive_ctrl_err() to should_reclaim()
Date: Wed,  2 Dec 2026 14:17:16 +0800	[thread overview]
Message-ID: <20261202061720.284064-3-baoquan.he@linux.dev> (raw)
In-Reply-To: <20261202061720.284064-1-baoquan.he@linux.dev>

From: Baoquan He <hebaoquan@kylinos.cn>

positive_ctrl_err() is named after control-theory jargon, which
obscures what the function actually asks: whether the candidate position
(pv) is worth reclaiming, i.e. it has a limited number of refaults or a
lower refaulted/total than the current position (sp).

Rename it to should_reclaim() so the reclaim decision is self-evident at
its call site.

Signed-off-by: Baoquan He <hebaoquan@kylinos.cn>
---
 mm/vmscan.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 257305fe1cce..ab5ba9997bd5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3298,11 +3298,12 @@ static void reset_ctrl_pos(struct lruvec *lruvec, int type, bool carryover)
 	}
 }
 
-static bool positive_ctrl_err(struct ctrl_pos *sp, struct ctrl_pos *pv)
+static bool should_reclaim(struct ctrl_pos *sp, struct ctrl_pos *pv)
 {
 	/*
-	 * Return true if the PV has a limited number of refaults or a lower
-	 * refaulted/total than the SP.
+	 * Return true if the candidate (PV) is worth reclaiming: it has a
+	 * limited number of refaults, or a lower refaulted/total than the
+	 * current position (SP).
 	 */
 	return pv->refaulted < MIN_LRU_BATCH ||
 	       pv->refaulted * (sp->total + MIN_LRU_BATCH) * sp->gain <=
@@ -4944,7 +4945,7 @@ static int get_tier_idx(struct lruvec *lruvec, int type)
 	read_ctrl_pos(lruvec, type, LRU_TIER_MIN, LRU_TIER_MIN, 2, &sp);
 	for (tier = LRU_TIER_MIN + 1; tier <= LRU_TIER_MAX; tier++) {
 		read_ctrl_pos(lruvec, type, tier, tier, 3, &pv);
-		if (!positive_ctrl_err(&sp, &pv))
+		if (!should_reclaim(&sp, &pv))
 			break;
 	}
 
-- 
2.52.0



  parent reply	other threads:[~2026-12-02  6:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  6:17 [PATCH 0/4] mm/mglru: cleanup series and a small correctness Baoquan He
2026-12-02  6:17 ` [PATCH 1/4] mm/mglru: use a common helper to check evictable type Baoquan He
2026-12-02  6:17 ` Baoquan He [this message]
2026-12-02  6:17 ` [PATCH 3/4] mm/mglru: split reset_ctrl_pos() into _update and _reset Baoquan He
2026-12-02  6:20 ` [PATCH 4/4] mm/mglru: stop counting isolation races as PGSCAN_SKIP in scan_folios() Baoquan He

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=20261202061720.284064-3-baoquan.he@linux.dev \
    --to=baoquan.he@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=hannes@cmpxchg.org \
    --cc=hebaoquan@kylinos.cn \
    --cc=kasong@tencent.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=qi.zheng@linux.dev \
    --cc=shakeel.butt@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox