From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E06C15530C for ; Tue, 17 Mar 2026 01:48:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773712101; cv=none; b=hIiECXp0jnW4X/Bbqqj05qw0pgg7tN1l30gaFVUpUMB7Xyij37MNGzSLztacjFfeFkmd1QyqDKleTVsMEryDLEOHVjr4uD8ENXaQTm8xMvkftNP0vdoVw5+MeETCzRRyeoOj2bK2euPFHvOvfkibp6k4C5H4r+XPvgqyILtvezM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773712101; c=relaxed/simple; bh=hvJheI06+88daZfkY366TTA9Ibs6LbXBDa08ge0Ii30=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PSD7JiOzwkPSg1v5TgDGS9Vr+n9XMXF6+Ohi2PTrGGeAbBduELFFZrcYIKzbIOCd/CB7f6zpf7R5b3BTFxT4V5ZYFHd8sc+ZXGzn+nk+zKrWmNVZfmZJOjFex/mOc5nrJmti+QuANZsgvu9SoGnp2ycSCMCfPlUdabw6pLOgo9A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QumXRDSY; arc=none smtp.client-ip=74.125.82.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QumXRDSY" Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-2b6b0500e06so5874694eec.1 for ; Mon, 16 Mar 2026 18:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773712099; x=1774316899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gJgt6Rfcb20kFAH/VM/j13KrTjlMfdecp1AACkp2FcQ=; b=QumXRDSYnYbpe9N7xDDzuTKFZM6EEuiUrAaYvQe1HbDraG/8FTPz354TfIWnaKX9YQ woQhGzm5og1SZBhMnklR8TYxHVgK7/ptCcc7SducSLOv0H6TUjMQzbyUyovsIrRMICIS +9fLFAmIQJmMjVGmpAhEag6m8I+A3QucCJPBr1gU8e5dnIZJtkmp1mBad8JsbA/VDde2 Utwj/4VEExODALMIFywMfzBF082BAhQClbWFYmIHkJGwmye8FTGSZX4yfRQcuMQcrQhh eV1Os/z4nFRm9r4NZ+n+rhOqAU7gjyPY/ghJZ8hIExhVXO58Uij4tN8HklNINHACWuxA ePDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773712099; x=1774316899; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gJgt6Rfcb20kFAH/VM/j13KrTjlMfdecp1AACkp2FcQ=; b=VYeNoSaW1oUdvMPJC8+5RAtcga3/2GQQjluk0RLzj2MN5tLZBmRA4jbpkuzpwHM2rM zSXZRT9XPCtiJqMcMpgQmYGLtoc5godNPwe5Ph69+UlD/Dyi91Co5N0rOldsJouYg+8H eK8XJTpDUgDwEySrT+3MIK+5pmLo5f0IU/5wWmYzXAGVAFJKFqZWse4v01VmhlgKUEX7 7wh20t5wygs0gIwMN0pjWXWlenGL5ZPnRy73t9j9t4RCw9/wEadi48rMMV5svVbFALpF 39VdU/WNEcCV0rbhdH7Jrxkhk5PDe0v/SWBJ/HmuwksmtALOn66Lo8UIxsAXIkjYSiCS gYoQ== X-Forwarded-Encrypted: i=1; AJvYcCWRIqnv/1b9ut5oHkD++dGxTiePiyKL62TIRdU+DdhpMK3ZwerW0V/OfQXcuof84ZdriLpAhzm/xjFV18c=@vger.kernel.org X-Gm-Message-State: AOJu0YzfA6cKASxMuLmKra9j8vOek7iKTgekW8OI3KyPEIthIw+A9sGr azvjZiry1CcWyGNEHwjJ7GIOeyDkcCFjmgPHdpJAttcx0bTXS57KHBdP X-Gm-Gg: ATEYQzySxEfJqth6TIcky/M5pm0acN8OuKH9EP5C2Od7XHAvETPNa/AfPf7JFjiagyg 3fbSA1NvOt4kO8RcNql+aGNG3kLYAJ0YqAudG48z0ewE/cCE0j8N9qr4uulgVRXWNeIoZCeH0Km 4tZK2lAGAa3BJOSaWYSmIU7a0RGWPzafx2nccuia/sChmsEHr/IkXuxcpBBP4HjPv0IQXH/XnME tQEgwWwBTlHuAkfHoyywjIIDAsfbzEM60xi95re+JLv0TRGbEHeXKetmUwQ8R2Gi+JEI+/S3V4T ONGeuhbRiDZA5e2N1OgEmx7zDCkgJhCFuOH9xT2H4GtqG+zzttYoEwu+5C4mn9TdJeico8+BBbw VKPXRZcVRbxDtjJtDv/6GRZJ1aRNbjpr3FyTDLpQ8zvxdWjDbHsKpY84Sos2Y3YFTG3jArSukcx ptd8HFdPyh6h3YuLwsT1XWjz/ov/JXvxkJP/aqjQ== X-Received: by 2002:a05:7300:6ca0:b0:2b7:b7e7:9025 with SMTP id 5a478bee46e88-2bea55032f8mr6673539eec.31.1773712099126; Mon, 16 Mar 2026 18:48:19 -0700 (PDT) Received: from penguin.lxd ([2601:647:6400:3ec0:216:3eff:fecd:e4ef]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2beab3a12e2sm17931130eec.2.2026.03.16.18.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 18:48:18 -0700 (PDT) From: "Kanchana P. Sridhar" 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 v2 0/2] zswap pool per-CPU acomp_ctx simplifications Date: Mon, 16 Mar 2026 18:48:00 -0700 Message-Id: <20260317014802.27591-1-kanchanapsridhar2026@gmail.com> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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