Message ID | 20231213-zswap-dstmem-v5-0-9382162bbf05@bytedance.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 505E1C3DA6E for <linux-mm@archiver.kernel.org>; Thu, 28 Dec 2023 09:46:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B57C46B00B1; Thu, 28 Dec 2023 04:46:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B083B6B00B2; Thu, 28 Dec 2023 04:46:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F6566B00B3; Thu, 28 Dec 2023 04:46:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 91F216B00B1 for <linux-mm@kvack.org>; Thu, 28 Dec 2023 04:46:23 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5745B1403D7 for <linux-mm@kvack.org>; Thu, 28 Dec 2023 09:46:23 +0000 (UTC) X-FDA: 81615746646.13.CE06542 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) by imf24.hostedemail.com (Postfix) with ESMTP id 07949180005 for <linux-mm@kvack.org>; Thu, 28 Dec 2023 09:46:20 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.188 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bytedance.com (policy=quarantine) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703756781; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=I7Je+vH1SqMuVG9Fb6SmThVphhwvDV6qbxuvu4vLIa8=; b=09+Ujfs+D2zmXYuRSBpC9bmwzbH+hWQ1pFP+JK1MowMNklHw2pPy7abGGZRV9wv8ki6x6A NDPPsJ5QhHyhp+ni24dyRE5fwrT4Z9WqwAI99JbOfdN2YbSujU7wPrnuqmLRd3O/y9FcPQ /WNqDS+UwuC+jC9Dk4uMkwvU/JdareQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703756781; a=rsa-sha256; cv=none; b=2aE6n/sRVcMyjQQCqOV7+3UkbJs7WjwWjDHuhtMNaPCArJBEuFIgMFxeaXeNapLhA8Esli uBElhhJXdKZT/bXZTLlG7FKFbQAWg+B8VKPjcMp38A3pr9ksU+nzI5oCuJtg/6nkw71Iuf A0umA/RTV3qT5spleQKYmNuyngFe9Fw= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.188 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bytedance.com (policy=quarantine) Subject: [PATCH v5 0/5] mm/zswap: dstmem reuse optimizations and cleanups MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-b4-tracking: H4sIAMVDjWUC/33NTQrCMBAF4KtI1kby15q48h7iYpIZbcC20tSKSu/u4FK0q+E9eN+8RKEhUxG71U sMNOWS+45DtV6J1EB3JpmRszDKWG20lc9yh6vEMrbUSvTGn6raWmVR8CRCIRkH6FLDo+52uXDZ5DL2 w+PzYtJ8Dn+0SUslfai3DNYBldvHx0jIGm1S34ojY5NZAgwDCFBhAHIatr8AuwRYBhxBUiEGR4l+AW 4JcAycjPFRVQHRh29gnuc3d8znDnQBAAA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou <zhouchengming@bytedance.com> Date: Thu, 28 Dec 2023 09:45:41 +0000 Message-Id: <20231213-zswap-dstmem-v5-0-9382162bbf05@bytedance.com> To: Barry Song <21cnbao@gmail.com>, Yosry Ahmed <yosryahmed@google.com>, Nhat Pham <nphamcs@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Dan Streetman <ddstreet@ieee.org>, Vitaly Wool <vitaly.wool@konsulko.com>, Johannes Weiner <hannes@cmpxchg.org>, Chris Li <chriscli@google.com>, Seth Jennings <sjenning@redhat.com> Cc: Yosry Ahmed <yosryahmed@google.com>, Nhat Pham <nphamcs@gmail.com>, Chris Li <chrisl@kernel.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou <zhouchengming@bytedance.com> X-Developer-Signature: v=1; a=ed25519-sha256; t=1703756775; l=2769; i=zhouchengming@bytedance.com; s=20231204; h=from:subject:message-id; bh=HVI1JIYzdU7odrUyugqLS5ZpMBpfAXLpq1+kutx4nKw=; b=0ZIIj3q0AvnJDzfu1QIRATwdEZ4lGT8Sp64+BP+0MmtVvY8NBjuizS6I0A5yqJURcKS/GmKSh HqmUevQo/cEDsrYYuZujFQpKuvKBfv4KtWL89rCYgYtpKJ4J0+pifkM X-Developer-Key: i=zhouchengming@bytedance.com; a=ed25519; pk=xFTmRtMG3vELGJBUiml7OYNdM393WOMv0iWWeQEVVdA= X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 07949180005 X-Rspam-User: X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Stat-Signature: c1mbiomy5395uxnwt6uzyna8a11itx1f X-Rspamd-Server: rspam03 X-Rspam: Yes X-HE-Tag: 1703756780-867374 X-HE-Meta: U2FsdGVkX1/sjNS2j+kgc6Zqq/af/gB2vrxvy0W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0OA6q1KE281Qo6g4w0nAOpp/gzj7IdXF8PP/uqy2LmMr0+ffyDd1Nt0vl8U7Gbt3JiOP+DAlCtBdGv+B2J0HM/7RVkM3vng8mE7oK3GkizbrBHtTW0HeARRU7OQ2wcbyqGvF+3nSsx22E3MJjNmZzzJOeyijtnKYJOPWT6zU8y2czxixL1GHNOQCfQ89rCSYFBn9rq1+yt3S9x4I3IyRdwnfLFwoHo58ClUJrx1bDqOLwwkxMCwVUHPMgd4TSp7/6f40q6jAcy2YAEdlHvge1wkm15lf5ONZS6awC X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/zswap: dstmem reuse optimizations and cleanups
|
expand
|
Hi everyone, Changes in v5: - Drop the first patch and change to use 2 pages for acomp_ctx buffer. Related report link: https://lore.kernel.org/lkml/0000000000000b05cd060d6b5511@google.com/ - Add comment why we need 2 pages for compression in the last patch. - Link to v4: https://lore.kernel.org/r/20231213-zswap-dstmem-v4-0-f228b059dd89@bytedance.com Changes in v4: - Collect Reviewed-by and Acked-by tags. - Fold in the comment fix in zswap_writeback_entry() from Yosry Ahmed. - Add patch to change per-cpu mutex and dstmem to per-acomp_ctx. - Just rename crypto_acomp_ctx->dstmem field to buffer. - Link to v3: https://lore.kernel.org/r/20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com Changes in v3: - Collect Reviewed-by tag. - Drop the __zswap_store() refactoring part. - Link to v2: https://lore.kernel.org/r/20231213-zswap-dstmem-v2-0-daa5d9ae41a7@bytedance.com Changes in v2: - Add more changelog and test data about changing dstmem to one page. - Reorder patches to put dstmem reusing and __zswap_load() refactoring together, still refactor after dstmem reusing since we don't want to handle __zswap_load() failure due to memory allocation failure in zswap_writeback_entry(). - Append a patch to directly use percpu mutex and buffer in load/store and refactor out __zswap_store() to simplify zswap_store(). - Link to v1: https://lore.kernel.org/r/20231213-zswap-dstmem-v1-0-896763369d04@bytedance.com This series is split from [1] to only include zswap dstmem reuse optimizations and cleanups, the other part of rbtree breakdown will be deferred to retest after the rbtree converted to xarray. And the problem this series tries to optimize is that zswap_load() and zswap_writeback_entry() have to malloc a temporary memory to support !zpool_can_sleep_mapped(). We can avoid it by reusing the percpu crypto_acomp_ctx->dstmem, which is also used by zswap_store() and protected by the same percpu crypto_acomp_ctx->mutex. [1] https://lore.kernel.org/all/20231206-zswap-lock-optimize-v1-0-e25b059f9c3a@bytedance.com/ Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> --- Chengming Zhou (5): mm/zswap: reuse dstmem when decompress mm/zswap: refactor out __zswap_load() mm/zswap: cleanup zswap_load() mm/zswap: cleanup zswap_writeback_entry() mm/zswap: change per-cpu mutex and buffer to per-acomp_ctx include/linux/cpuhotplug.h | 1 - mm/zswap.c | 251 ++++++++++++++------------------------------- 2 files changed, 76 insertions(+), 176 deletions(-) --- base-commit: 1f242c1964cf9b8d663a2fd72159b296205a8126 change-id: 20231213-zswap-dstmem-d828f563303d Best regards,