Re: [PATCH] mm-unstable: Multi-gen LRU: Fix workingset accounting

From: Yu Zhao
Date: Tue May 23 2023 - 18:05:39 EST


On Tue, May 23, 2023 at 2:59 PM Kalesh Singh <kaleshsingh@xxxxxxxxxx> wrote:
>
> On Android app cycle workloads, MGLRU showed a significant reduction
> in workingset refaults although pgpgin/pswpin remained relatively
> unchanged. This indicated MGLRU may be undercounting workingset
> refaults.
>
> This has impact on userspace programs, like Android's LMKD, that
> monitor workingset refault statistics to detect thrashing.
>
> It was found that refaults were only accounted if the MGLRU shadow
> entry was for a recently evicted folio. However, recently evicted
> folios should be accounted as workingset activation, and refaults
> should be accounted regardless of recency.
>
> Fix MGLRU's workingset refault and activation accounting to more
> closely match that of the conventional active/inactive LRU.
>
> Fixes: ac35a4902374 ("mm: multi-gen LRU: minimal implementation")
> Cc: Yu Zhao <yuzhao@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Reported-by: Charan Teja Kalla <quic_charante@xxxxxxxxxxx>
> Signed-off-by: Kalesh Singh <kaleshsingh@xxxxxxxxxx>

Acked-by: Yu Zhao <yuzhao@xxxxxxxxxx>