Re: [PATCH mm-unstable] mm/zswap: global lru and shrinker shared by all zswap_pools fix
From: Johannes Weiner
Date: Tue Mar 05 2024 - 10:09:37 EST
On Tue, Mar 05, 2024 at 07:53:45AM +0000, Chengming Zhou wrote:
> The commit bf9b7df23cb3 ("mm/zswap: global lru and shrinker shared by
> all zswap_pools") introduced a new lock to protect zswap_next_shrink,
> instead of reusing zswap_pools_lock.
>
> But the problem is that it's initialized only when zswap enabled,
> which causes bug if zswap_memcg_offline_cleanup() called without
> zswap enabled.
>
> Fix it by using DEFINE_SPINLOCK() to statically initialize them
> and define them as multiple static variables to keep in consistent
> with the existing global variables in zswap.
>
> Fixes: bf9b7df23cb3 ("mm/zswap: global lru and shrinker shared by all zswap_pools")
> Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-lkp/202403051008.a8cf8a94-lkp@xxxxxxxxx
> Signed-off-by: Chengming Zhou <chengming.zhou@xxxxxxxxx>
Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>