Message ID | 20231213-zswap-dstmem-v3-0-4eac09b94ece@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 C4748C35274 for <linux-mm@archiver.kernel.org>; Mon, 18 Dec 2023 11:50:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5128F8D000B; Mon, 18 Dec 2023 06:50:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 49AD68D0001; Mon, 18 Dec 2023 06:50:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33BD78D000B; Mon, 18 Dec 2023 06:50:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1D6B28D0001 for <linux-mm@kvack.org>; Mon, 18 Dec 2023 06:50:44 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D5D111210FC for <linux-mm@kvack.org>; Mon, 18 Dec 2023 11:50:43 +0000 (UTC) X-FDA: 81579771966.22.4330D59 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) by imf07.hostedemail.com (Postfix) with ESMTP id 3B74040015 for <linux-mm@kvack.org>; Mon, 18 Dec 2023 11:50:40 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.174 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702900241; a=rsa-sha256; cv=none; b=KOOLZUbpWCPfHXqj2xEzhJdk0fErHnU2c1SBY1KeI1E6l5vb+tkTDKaqLLpjbAYsWCzEeT Dyys3rf5AyrnJTbOUXbA5uO5oAkNUA8Ytrc6EcXnvrjTfP8EZSI/Gs+mHqnOPFUeuVbp6o U2dWmjCkt3hnjbCSy69t8tO9lqTxOoE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.174 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=1702900241; 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=VKUTdaeZ4aOl4LFhnNArx4kCgwl8PwdbKaxSzxWHo+4=; b=G+VcyvuMkA611r/IM+m0A+ydkbX64Ov1zqakAw6jlPOEQnrGUeNjY3VxlgOfSSwxUYfWR5 Ts9nZEUW4jq6jyESNVAJ6N/YMG68lT/tV76QHZ4thc0Tv0ZBGPyv+hMCVs0uEUXBU0TFaa EXrn0gNLktJCSm/anBvgCggs/U1dvto= Subject: [PATCH v3 0/6] 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: H4sIAAYygGUC/33NywrCMBAF0F8pWRvJo09X/oe4mHZGG2jTktRILf13B5eCroZ74Z7ZRKTgKIpTto lAyUU3eQ72kImuB38n6ZCzMMpYbbSVr/iEWWJcRhol1qa+FaW1yqLgSQuRZBvAdz2P/GMYuOxdXKaw fl4kzefyQ0taKlk3ZcVg2aDKz+26ELJGx24axZWxZP4BhgEEKLAByjVU38C+72+9xmDV8gAAAA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou <zhouchengming@bytedance.com> Date: Mon, 18 Dec 2023 11:50:30 +0000 Message-Id: <20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com> To: Seth Jennings <sjenning@redhat.com>, Yosry Ahmed <yosryahmed@google.com>, Vitaly Wool <vitaly.wool@konsulko.com>, Dan Streetman <ddstreet@ieee.org>, Johannes Weiner <hannes@cmpxchg.org>, Chris Li <chriscli@google.com>, Andrew Morton <akpm@linux-foundation.org>, Nhat Pham <nphamcs@gmail.com> Cc: Chris Li <chrisl@kernel.org>, Yosry Ahmed <yosryahmed@google.com>, linux-kernel@vger.kernel.org, Chengming Zhou <zhouchengming@bytedance.com>, linux-mm@kvack.org, Nhat Pham <nphamcs@gmail.com> X-Developer-Signature: v=1; a=ed25519-sha256; t=1702900234; l=2082; i=zhouchengming@bytedance.com; s=20231204; h=from:subject:message-id; bh=L8x6KYYzMw8PAizyBBXr2eeH9yLgNTCwGP96aZA5ke0=; b=qtdZDlnipwv56Yz76sAz57UAeGKlswtXjtwY43QfKjITSQACoYeG0j5Bb4gDUS4t8hFdZYK5h oeibYk1o3/4DbUrMH6cUKspJSbCbYcbz+XVTUqsLgmTywADAlh3z3Nx X-Developer-Key: i=zhouchengming@bytedance.com; a=ed25519; pk=xFTmRtMG3vELGJBUiml7OYNdM393WOMv0iWWeQEVVdA= X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3B74040015 X-Stat-Signature: de7h86afff1733tzb5d6d4pzpexmsm64 X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Rspam: Yes X-HE-Tag: 1702900240-739861 X-HE-Meta: U2FsdGVkX1+6h0rVJ88nMUQDTfJoEfZvOcaIiddD8vOS8kzvBbVo3vmeYApv68ybk/KV43zGrA3eh7zOPfXeLmmfM9pDw7LiWSorvnktS042nkE2nscWa5RJAbGIyiYZydRtWRZ86A9/4ZKMqh/dN3gscHfL958XW2hAEdvezU39j1EYUa0LhGkGg2IeLe3/RuWKWFm78W78UOguko36DgdsErsev6w9pwTio9eDZVtT5jfokneblvLG2lpdZ3/2nxCzmCEhYnt1Pg6nfl8TQwbDRCQXOMrb5V7aQ2iCB0zcogDMJkcaWTkMZp8xv/gqoWS/lpUPcQCPJ7tzVJuy8S5So3KZYhazKnJ9tbYrJkXAhuq3LgyuDt7FQt0GxM3IRpOR4QWCyUttku1ifh9x/T7mKwKKderrj4CrSl6oZd16Qmtr8ZHoFx4xmFiNsXH12DXnAvw0duG7JClq185Cpl8y3y4Qn+fvoPkfd6jqVqBXY2jt03DRV/y0rBySDK+60mp5t57MY5o/MJ7mII0DgYO51Wj368VrQQ4014UACr51kdBXCbZjekW3pIJO73IQa16C88oX0X4R8xZtX36Ck1lu+Z9VlyAPANBZJgxLo+5FAAFfWB99h3m1YcobormZMDMV5E3r74M4WUuOGEh8HQWzN9HMqM6YvJAZxY9F1T4OMVJ/DYRbzSeFkengd9zPj9ltAaQ5qLqo8I+G2k8Hb+O8o0cHnJpWIVr1iVYfGHiDFYESiLFUIrmdVdoWJrkYKk2ibhKOOwTw1D8HJYhA+mSixvn+y+BNvuyqT1+cAYvTIx/B+WoAc5D2DbMK7sR5Bf1+bWXbbU6kcDgFeSKFqJACWLUMzoeKS/lKiFx2sfWE5bNLihbmWa8OdL3oBu76MizJBbkTqALsgoFL28gsucEE/Ig2HY45A3gxf5P0f0pfhfdtcDOIsLpgnprmW8e4qjnuiKGYnt3Ja4dZ1gg zoWchTd1 zpxs/ 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 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 (6): mm/zswap: change dstmem size to one page 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: directly use percpu mutex and buffer in load/store mm/zswap.c | 209 +++++++++++++++++++++++-------------------------------------- 1 file changed, 77 insertions(+), 132 deletions(-) --- base-commit: 1f242c1964cf9b8d663a2fd72159b296205a8126 change-id: 20231213-zswap-dstmem-d828f563303d Best regards,