Re: [PATCH 5/7] mm/mglru: use explicit tier range in read_ctrl_pos()
Barry Song <[email protected]>
| Newsgroups | org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <CAGsJ_4zC7-8OgMEep58TEt0gfcShUSsKeYBGUW5BGEk8U+m8Jw@mail.gmail.com> |
On Tue, Aug 18, 2026 at 1:38 PM Kairui Song via B4 Relay <[email protected]> wrote: > > From: Kairui Song <[email protected]> > > 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 <[email protected]> > --- Reviewed-by: Barry Song <[email protected]>