Re: [PATCH 5/7] mm/mglru: use explicit tier range in read_ctrl_pos()

From: Barry Song

Date: Wed Aug 19 2026 - 17:24:57 EST


On Tue, Aug 18, 2026 at 1:38 PM Kairui Song via B4 Relay
<devnull+kasong.tencent.com@xxxxxxxxxx> 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>
> ---

Reviewed-by: Barry Song <baohua@xxxxxxxxxx>