Re: [PATCH v5 5/5] mm/zswap: change per-cpu mutex and buffer to per-acomp_ctx

From: Yosry Ahmed
Date: Thu Dec 28 2023 - 10:19:54 EST


On Thu, Dec 28, 2023 at 1:46 AM Chengming Zhou
<zhouchengming@xxxxxxxxxxxxx> wrote:
>
> First of all, we need to rename acomp_ctx->dstmem field to buffer,
> since we are now using for purposes other than compression.
>
> Then we change per-cpu mutex and buffer to per-acomp_ctx, since
> them belong to the acomp_ctx and are necessary parts when used
> in the compress/decompress contexts.
>
> So we can remove the old per-cpu mutex and dstmem.
>
> Acked-by: Chris Li <chrisl@xxxxxxxxxx> (Google)
> Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx>
> Signed-off-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>

Instead of hardcoding PAGE_SIZE * 2 multiple times, can we define a
constant for this and document the need for the buffer size there?
Even better if that constant is based on WORST_COMPR_FACTOR and shared
between zswap and zram -- but this can be a follow up change.