Re: [PATCH 5/7] mm/mglru: use explicit tier range in read_ctrl_pos()
From: Baolin Wang
Date: Wed Aug 19 2026 - 05:25:59 EST
On 8/18/26 1:38 PM, Kairui Song via B4 Relay wrote:
From: Kairui Song <kasong@xxxxxxxxxxx>
read_ctrl_pos() encodes the tier range in a single "tier" parameter
via "tier % MAX_NR_TIERS" as the start and "min(tier, MAX_NR_TIERS-1)"
as the end. This is hard to follow, maintain, or extend. Tier values
0..3 select a single tier, while tier == MAX_NR_TIERS selects the
full range.
Replace it with explicit (tier_min, tier_max) parameters using a
closed [tier_min, tier_max] interval, and add LRU_TIER_MIN and
LRU_TIER_MAX for the tier bounds. The call sites now become
self-documenting:
- get_tier_idx: (LRU_TIER_MIN, LRU_TIER_MIN) for the first tier,
(tier, tier) for each subsequent tier
- get_type_to_scan: (LRU_TIER_MIN, LRU_TIER_MAX) for the full range
No functional change.
Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
---
Yes. More readable.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>