Re: [PATCH v3 5/6] mm/mglru: use explicit tier range in read_ctrl_pos()
From: Lian Wang
Date: Fri Aug 28 2026 - 01:30:24 EST
Hi Kairui,
> Replace it with explicit (tier_min, tier_max) parameters using a
> closed [tier_min, tier_max] interval
While touching read_ctrl_pos(), would it make sense to add:
lockdep_assert_held(&lruvec->lru_lock);
All current callers run under the lruvec lock. read_ctrl_pos() derives the
history slot from min_seq and combines avg_refaulted/avg_total and protected
with the atomic counters, while reset_ctrl_pos() rotates and clears that
state under the same lock and already has this assertion.
Adding the assertion here would document the snapshot contract and catch a
future lockless caller before it can observe fields from different history
epochs.
If I missed an existing lockless caller, or if this is intentionally a
best-effort snapshot, please ignore this suggestion.
Thanks,
Lian