Re: [PATCH] cachestat: do not flush stats in recency check

From: Shakeel Butt
Date: Thu Jun 27 2024 - 21:58:50 EST


On Thu, Jun 27, 2024 at 01:17:37PM GMT, Nhat Pham wrote:
> syzbot detects that cachestat() is flushing stats, which can sleep, in
> its RCU read section (see [1]). This is done in the
> workingset_test_recent() step (which checks if the folio's eviction is
> recent).
>
> Move the stat flushing step to before the RCU read section of cachestat,
> and skip stat flushing during the recency check.
>
> [1]: https://lore.kernel.org/cgroups/000000000000f71227061bdf97e0@xxxxxxxxxx/
>
> Reported-by: syzbot+b7f13b2d0cc156edf61a@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/cgroups/000000000000f71227061bdf97e0@xxxxxxxxxx/
> Debugged-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> Suggested-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> Signed-off-by: Nhat Pham <nphamcs@xxxxxxxxx>
> Fixes: b00684722262 ("mm: workingset: move the stats flush into workingset_test_recent()")
> Cc: stable@xxxxxxxxxxxxxxx # v6.8+

Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>