Re: [PATCH v14 23/26] mm: zswap: Tie per-CPU acomp_ctx lifetime to the pool.
From: Kanchana P. Sridhar
Date: Sat Mar 14 2026 - 01:18:28 EST
On Wed, 4 Feb 2026 16:29:35 +0000, Yosry Ahmed wrote:
[...]
> LGTM with a small nit below:
>
> Acked-by: Yosry Ahmed <yosry.ahmed@xxxxxxxxx>
>
Thanks!
[...]
> > +static void acomp_ctx_dealloc(struct crypto_acomp_ctx *acomp_ctx)
> > +{
> > + if (IS_ERR_OR_NULL(acomp_ctx))
> > + return;
> > +
> > + if (!IS_ERR_OR_NULL(acomp_ctx->req))
> > + acomp_request_free(acomp_ctx->req);
> > +
> > + if (!IS_ERR_OR_NULL(acomp_ctx->acomp))
> > + crypto_free_acomp(acomp_ctx->acomp);
>
> Should we set acomp_ctx->req, acomp_ctx->acomp, and acomp_ctx->buffer to
> NULL here?
>
> zswap_cpu_comp_prepare() uses NULL to detect that we need to initialize
> acomp_ctx.
>
I don't think this is needed, because with the changes made in this
patch, there is no scenario in which zswap_cpu_comp_prepare() will be
called *after* acomp_ctx_dealloc() deletes these resources.
zswap_cpu_comp_prepare() is called only during pool creation or after a
subsequent CPU hotplug operation (for a CPU getting onlined when it was
offline at pool creation time, or, due to an offline-online
transition of a CPU that was online at pool creation time). In both
these cases, the per-CPU acomp_ctx members are either NULL or valid.
Thanks,
Kanchana
> > +
> > + kfree(acomp_ctx->buffer);
> > +}
> > +