Re: [PATCH v5 02/17] mm/memcontrol: allow update of LRU statistic without holding LRU lock

From: KunWu Chan

Date: Fri Nov 20 2026 - 01:49:17 EST


Reviewed-by: Kunwu Chan <kunwu.chan@xxxxxxxxx>

Thanks,
Kunwu

On Thu, Nov 19, 2026 at 5:03 AM Kairui Song via B4 Relay
<devnull+kasong.tencent.com@xxxxxxxxxx> wrote:
>
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> To enable moving file pages in folio_mark_accessed directly and lazily
> for MGLRU, allow updating the LRU statistic atomically without holding a
> lock. It may cause temporary counter underflow, which should be fine as
> the counter is eventually consistent and only serves as an estimate.
>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---
> include/linux/mm_inline.h | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
> index 2395ca8ee305..2edb9beef6d3 100644
> --- a/include/linux/mm_inline.h
> +++ b/include/linux/mm_inline.h
> @@ -47,12 +47,11 @@ static __always_inline void __update_lru_size(struct lruvec *lruvec,
> {
> struct pglist_data *pgdat = lruvec_pgdat(lruvec);
>
> - lockdep_assert_held(&lruvec->lru_lock);
> WARN_ON_ONCE(nr_pages != (int)nr_pages);
>
> mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
> - __mod_zone_page_state(&pgdat->node_zones[zid],
> - NR_ZONE_LRU_BASE + lru, nr_pages);
> + mod_zone_page_state(&pgdat->node_zones[zid],
> + NR_ZONE_LRU_BASE + lru, nr_pages);
> }
>
> static __always_inline void update_lru_size(struct lruvec *lruvec,
>
> --
> 2.56.1
>
>