Re: [PATCH v5 1/6] mm/zswap: Fix global shrinker when memory cgroup is disabled
From: Nhat Pham
Date: Wed Jul 01 2026 - 13:33:52 EST
On Tue, Jun 30, 2026 at 3:51 AM Hao Jia <jiahao.kernel@xxxxxxxxx> wrote:
>
>
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 4b5149173b0e..9d4f19fc440e 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1361,11 +1361,12 @@ static void shrink_worker(struct work_struct *w)
> } while (memcg && !mem_cgroup_tryget_online(memcg));
> spin_unlock(&zswap_shrink_lock);
>
> - if (!memcg) {
> - /*
> - * Continue shrinking without incrementing
> failures if
> - * we found candidate memcgs in the last tree walk.
> - */
> + /*
> + * A NULL memcg ends a full hierarchy pass (except when
> memcg is
> + * disabled, where it is always NULL: fall through to
> the root LRU).
> + * Count a failure only if the pass found no candidates.
> + */
> + if (!memcg && !mem_cgroup_disabled()) {
> if (!attempts && ++failures == MAX_RECLAIM_RETRIES)
> break;
>
With Yosry's suggestion:
Acked-by: Nhat Pham <nphamcs@xxxxxxxxx>