linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kanchana P. Sridhar" <kanchanapsridhar2026@gmail.com>
To: hannes@cmpxchg.org, yosry@kernel.org, nphamcs@gmail.com,
	chengming.zhou@linux.dev, akpm@linux-foundation.org,
	kanchanapsridhar2026@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Cc: herbert@gondor.apana.org.au, senozhatsky@chromium.org
Subject: [PATCH v3 0/2] zswap pool per-CPU acomp_ctx simplifications
Date: Tue, 31 Mar 2026 11:33:49 -0700	[thread overview]
Message-ID: <20260331183351.29844-1-kanchanapsridhar2026@gmail.com> (raw)

This patchset first removes redundant checks on the acomp_ctx and its
"req" member in zswap_cpu_comp_dead().

Next, it persists the zswap pool's per-CPU acomp_ctx resources to
last until the pool is destroyed. It then simplifies the per-CPU
acomp_ctx mutex locking in zswap_compress()/zswap_decompress().

Code comments added after allocation and before checking to deallocate
the per-CPU acomp_ctx's members, based on expected crypto API return
values and zswap changes this patchset makes.

Patch 2 is an independent submission of patch 23 from [1], to
facilitate merging.

[1]: https://patchwork.kernel.org/project/linux-mm/list/?series=1046677

Changes since v2:
=================
1) Rebased to mm-unstable as of 3-31-2026 (commit 24e341657c28).
2) Collected Acks.

Changes since v1:
=================
1) Made the changes to eliminate redundant checks on
   acomp_ctx/acomp_ctx->req in zswap_cpu_comp_dead(), per Yosry.
2) Renamed acomp_ctx_dealloc() to acomp_ctx_free(), per Yosry.
3) Incorporated suggestions from Yosry and Sashiko to reset the
   acomp_ctx's members to NULL after freeing them, to prevent UAF and
   double free issues.
4) Replaced v1's patch 2 with v2's patch 1.


Kanchana P. Sridhar (2):
  mm: zswap: Remove redundant checks in zswap_cpu_comp_dead().
  mm: zswap: Tie per-CPU acomp_ctx lifetime to the pool.

 mm/zswap.c | 182 +++++++++++++++++++++++++----------------------------
 1 file changed, 85 insertions(+), 97 deletions(-)

-- 
2.39.5



             reply	other threads:[~2026-03-31 18:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 18:33 Kanchana P. Sridhar [this message]
2026-03-31 18:33 ` [PATCH v3 1/2] mm: zswap: Remove redundant checks in zswap_cpu_comp_dead() Kanchana P. Sridhar
2026-03-31 18:33 ` [PATCH v3 2/2] mm: zswap: Tie per-CPU acomp_ctx lifetime to the pool Kanchana P. Sridhar
2026-03-31 19:22 ` [PATCH v3 0/2] zswap pool per-CPU acomp_ctx simplifications Yosry Ahmed
2026-03-31 20:58   ` Kanchana P. Sridhar
2026-03-31 22:19     ` Andrew Morton
2026-03-31 22:38       ` Kanchana P. Sridhar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260331183351.29844-1-kanchanapsridhar2026@gmail.com \
    --to=kanchanapsridhar2026@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=yosry@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox