Message ID | 20240210-zswap-global-lru-v1-0-853473d7b0da@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 10EF8C4829B for <linux-mm@archiver.kernel.org>; Sun, 11 Feb 2024 13:58:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CC946B0071; Sun, 11 Feb 2024 08:58:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 27C466B0072; Sun, 11 Feb 2024 08:58:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1928A6B0074; Sun, 11 Feb 2024 08:58:00 -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 0AC276B0071 for <linux-mm@kvack.org>; Sun, 11 Feb 2024 08:58:00 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D0013A1D16 for <linux-mm@kvack.org>; Sun, 11 Feb 2024 13:57:59 +0000 (UTC) X-FDA: 81779676678.08.84D5BDD Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) by imf11.hostedemail.com (Postfix) with ESMTP id E1B0840013 for <linux-mm@kvack.org>; Sun, 11 Feb 2024 13:57:57 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.171 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=1707659878; 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=8TnxYRQcdtQTffITeD+LqCzbGgUsyFpCurnLQ4+2uBs=; b=Fqlb+ZKlgYKm9MhQleQozemAgjO0sITL4xHictni9oCImdg+Fi9VIgggvL5/mKiRtF5m1U oNTFUsKTXItO0scYLkEe5+LL3KeEb9yL2Y+MOD5U0ytCoVacAQ2IzXhX0NWyWBsxOkGtUx cxHOH8y7XkNSJR1vSsgiQPUDTFQnao0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707659878; a=rsa-sha256; cv=none; b=pqcxwWhisoZu8bkMxqP9wzEq0iocWSWN56jSJwQoCofsiDIm/4qvDkC+CecdmzVwwfdMN4 814SCI791R1KjzLS3KESc7il80cye8jZz+ooQU50EwhehhK2pK/GFTXORJcDZSk6plt+IH bFXp9QHQ1ZtgP14mcIgQ4hMqoBKymuY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.171 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 0/2] mm/zswap: optimize for dynamic zswap_pools MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-b4-tracking: H4sIAC/SyGUC/w3LSwqAIBAA0KvErBtQk363GWsoYbBwqCDp7rl8i1dAOUdWmJsCme+o8UgVtm1g2S ltjHGtBmecN84afPWhEzc5AglKvnDyq58629thDFBbIGUMmdKy15guke/7AQQSc7dnAAAA X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou <zhouchengming@bytedance.com> Date: Sun, 11 Feb 2024 13:57:03 +0000 Message-Id: <20240210-zswap-global-lru-v1-0-853473d7b0da@bytedance.com> To: Andrew Morton <akpm@linux-foundation.org>, Johannes Weiner <hannes@cmpxchg.org>, Yosry Ahmed <yosryahmed@google.com>, Nhat Pham <nphamcs@gmail.com> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou <zhouchengming@bytedance.com> X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: E1B0840013 X-Rspam-User: X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Stat-Signature: d7yo4ope4i48eqmwjowi8fpix6tbjahf X-Rspamd-Server: rspam03 X-Rspam: Yes X-HE-Tag: 1707659877-759684 X-HE-Meta: U2FsdGVkX18qlCxwyipfLeRitwEE/rBZbL01R5OVj6sma++KpvME088qdRYeVbiqW9R1KDEp5CXElylwzjJDzSdqWSo/iwdhFEqGfxZwOuSE3fV5tkhO/CD17lfMabclNnhXveH+DfRD8eisS5h5n42K6DBVcTTCKrSrMVGf3+wYt6uwHCJimynFtJSbSSkLtUYFIlFe0BrY/vmhXideLsMz8ThouRF3GIq8ORuhYsFcOIXUm5dhi/4W5ULQxtkoaqKpypStUP7eem9JNdasCNxYh67neAXqiLuzRurh/fOTh/HK8q8tY6giEDspkmBeI0KqyrMPSiA8vjctNxpTx8zhlUNptvmT45N9PR78dDrw9SfgTF3nCA0zALyxWajv55+MN6Gk5fN88nwe6iT/6ysQ3l+Dhjw17V6Z+5P9o/8MiZBDwJKnCV35wQGBiv8/y0iPGnHqA9J2MAhQxIamE1NJIALNpm2LIjCWJ9I0ig/8C5KFLzj7BHePSjEo8KE/4bT/cgURrCSriAnx9Z/IDSqyhSbTisM+fkRsQQEGmOuI3ijEGNtiMyRwzGWIfMpkaGu0EGfAeTdRDpl3DkUSc+zvCDXYAY+eXqfBPN3N8/0qXXB+d8svS+3otKxiRwNOOw0k4sP/oGgEVgF20ytcxGDXW9eJ+dVq2Dq82Z/jqfq2/N9D1w6gRnPN1Mw2kVcspYfL7IaWeKjcT/Mg3+WCqfJLgkZzJdZdDhEt+7VEFIwqFF8Ux3lnozZFGTloj14NL2aQ5hxz3J/54aZYO0Kz31iNwh9d9YTxNfnHWPCqUjo+M9ARP5c0pjv+/6G9pH1GvshpNsWQASInC4baC8pV7wsuY12lXcvs4dSl/XkiwS9e15aiR6JY57zUOWeUtLl6y/OKeSXQ8faEfOmc9JXszrNIAdvwgM7Xh+xWjmIId4Xju+J29uvAF1cz8YFIxa6xb7kbV+LopInkq23wNvt BSk2YRpc gaKXz4CcndbxZPA/qCRoFcw3iKYt763nssB+esMzsunE0PsjfRrXjJwN/cWlCtvaQNFH1SO11J325ORwCzf1RtHZWqZ5NHv6Z44XpY7+ZhgbO0EY+GVWOM9/QAssxvV3YjNS1WXhEBnV6b2J7JDe5vXhrZspkFkf4FWgM5Sn262FVrMM4R42n160cwSZRSLkNKHbIT+EgxcViq0RGkdG8eMizo77K1oZ8jUbKaifz95/62hS0rH2KN+qxo1ZXVj5VH0STNnB3ehWCxmhNSVBb9ZokczpV4AaH2ChqoZsbSkBTIL0He0pcnW6eu3xEC7Kr4xss46LA840wd9Vaz9QDKnf5kWHGVwYivDKNNjVIvVfa9QPLvHkbPta2/g== 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: optimize for dynamic zswap_pools
|
expand
|
Dynamic pool creation has been supported for a long time, which maybe not used so much in practice. But with the per-memcg lru merged, the current structure of zswap_pool's lru and shrinker become less optimal. In the current structure, each zswap_pool has its own lru, shrinker and shrink_work, but only the latest zswap_pool will be the current used. 1. When memory has pressure, all shrinkers of zswap_pools will try to shrink its lru list, there is no order between them. 2. When zswap limit hit, only the last zswap_pool's shrink_work will try to shrink its own lru, which is inefficient. A more natural way is to have a global zswap lru shared between all zswap_pools, and so is the shrinker. The code becomes much simpler too. Another optimization is changing zswap_pool kref to percpu_ref, which will be taken reference by every zswap entry. So the scalability is better. Testing kernel build in tmpfs with memory.max=2GB (zswap shrinker and writeback enabled with one 50GB swapfile). mm-unstable zswap-global-lru real 63.20 63.12 user 1061.75 1062.95 sys 268.74 264.44 Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> --- Chengming Zhou (2): mm/zswap: global lru and shrinker shared by all zswap_pools mm/zswap: change zswap_pool kref to percpu_ref mm/zswap.c | 183 +++++++++++++++++++++++++------------------------------------ 1 file changed, 76 insertions(+), 107 deletions(-) --- base-commit: 191d97734e41a5c9f90a2f6636fdd335ae1d435d change-id: 20240210-zswap-global-lru-94d49316178b Best regards,