Message ID | 20240617-zsmalloc-lock-mm-everything-v1-0-5e5081ea11b3@linux.dev (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 A6807C2BA15 for <linux-mm@archiver.kernel.org>; Mon, 17 Jun 2024 12:58:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9C586B012F; Mon, 17 Jun 2024 08:58:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4C406B0177; Mon, 17 Jun 2024 08:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CED136B018F; Mon, 17 Jun 2024 08:58:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AFE176B012F for <linux-mm@kvack.org>; Mon, 17 Jun 2024 08:58:32 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D15F4C15C8 for <linux-mm@kvack.org>; Mon, 17 Jun 2024 12:58:31 +0000 (UTC) X-FDA: 82240384422.24.0FE5B41 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) by imf13.hostedemail.com (Postfix) with ESMTP id 621AB2001B for <linux-mm@kvack.org>; Mon, 17 Jun 2024 12:58:29 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=NkXMzD2B; spf=pass (imf13.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.186 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718629105; 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:dkim-signature; bh=LhE5GerIuky+iWF4C4KHZxHl5t3Dhdt0MaEcD7DaEsk=; b=jTO+CTkiSYBQpu2zQZSq2kdCsXfgkAzPk2pbdlu7H9BQpHjU25aZen7+f/25LYUOPOegOR uPsMYxDakeM+I7iQ/OnfT2uno55SJUrVnsQlnaiJlL0+qoISmbPXj3gP7Xe/IVcCh5f2W9 eIUwrxh4f3TXd9hdjLL8joeKlSstKNg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=NkXMzD2B; spf=pass (imf13.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.186 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718629105; a=rsa-sha256; cv=none; b=RmUy+ahEqWkOkkx2rBgxx7kJI+Nd2p3nornNyO2u4FzQ1cypsLkfMeAzhb8ew5TOjPQxsX gIaYNHH8q+76msdbWCCKxZbo6hEk0eZuRhJqRZdyxYWY7jQg4PQieH5W5b13RMWloiJ7yu aO4Dm4sfLR4ZoSgCNHSoUh9bZOstKzE= X-Envelope-To: zhouchengming@bytedance.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1718629107; h=from:from: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; bh=LhE5GerIuky+iWF4C4KHZxHl5t3Dhdt0MaEcD7DaEsk=; b=NkXMzD2B9dj2qK2dt1EReRRc55Klfna1SYWcfLP48rL/PlxVfGVWWC9peMzBfPjJw7iOT+ wjdrA4nMYuuhXlsjmdK7kwyS+T+GanthCtdwg4OT4JxvWBozqV/id4tyc0o/56t+VdlRRk siRsgl3zewrDhPTqblGaV8G8wYrY4bM= X-Envelope-To: minchan@kernel.org X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: senozhatsky@chromium.org X-Envelope-To: nphamcs@gmail.com X-Envelope-To: flintglass@gmail.com X-Envelope-To: linux-mm@kvack.org X-Envelope-To: yosryahmed@google.com X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: chengming.zhou@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou <chengming.zhou@linux.dev> Subject: [PATCH 0/2] mm/zsmalloc: change back to per-size_class lock Date: Mon, 17 Jun 2024 20:57:39 +0800 Message-Id: <20240617-zsmalloc-lock-mm-everything-v1-0-5e5081ea11b3@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAMMycGYC/x3MSQqAMAxA0atI1gaccLqKuAg1atBWaaU44N0tL v7ibf4Djq2wgzZ6wLIXJ5sJSOMI1ExmYpQhGLIkK5IyrfB2mtZ1UxhaUGtkz/Y6ZjET5nVFA5W ck2ogHHbLo5z/vevf9wOOhJzbbQAAAA== To: Minchan Kim <minchan@kernel.org>, Sergey Senozhatsky <senozhatsky@chromium.org>, Andrew Morton <akpm@linux-foundation.org>, Johannes Weiner <hannes@cmpxchg.org>, Yosry Ahmed <yosryahmed@google.com>, Nhat Pham <nphamcs@gmail.com> Cc: Takero Funaki <flintglass@gmail.com>, Chengming Zhou <zhouchengming@bytedance.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou <chengming.zhou@linux.dev> X-Developer-Signature: v=1; a=ed25519-sha256; t=1718629103; l=1719; i=chengming.zhou@linux.dev; s=20240617; h=from:subject:message-id; bh=Uax/c7+sLz4sjtkyfwBC5I+goM5LE5/SzcO4Oqcruq8=; b=A0tE65qrzF8XFHhYayouNtAAv60P5BRip7QjzITZqmguqKp1XxX6F5N5PMVtNa6MjEAgJe6iM /qfBmi/s/MPAtnKKpz7zjf165JAB808L3jKcV7ve8Fv4hu0ad6h/WI1 X-Developer-Key: i=chengming.zhou@linux.dev; a=ed25519; pk=/XPhIutBo+zyUeQyf4Ni5JYk/PEIWxIeUQqy2DYjmhI= X-Migadu-Flow: FLOW_OUT X-Stat-Signature: q36i9o1dif6nfg9w5jqoonfhsjn91c47 X-Rspam-User: X-Rspamd-Queue-Id: 621AB2001B X-Rspamd-Server: rspam02 X-HE-Tag: 1718629109-631248 X-HE-Meta: U2FsdGVkX1+0xS7rBlId+g1SxulGxArxWoiRa+StNVP+WOpjKse0HQbh1+zdMR0gExutqg3UFboZoc16XtCDkSZVtpDnv2LCLzpnS7NaBsbBc7V7ynssZZQGsocRmMB+IpF0iYGv0mu8/c+ijXGwaKcFEqALF5Y0hleJokK9hoZ6YahSXZOVl77zuE9+an8mrygmQ2D8M8Y70Bu/PnPRWjkHS2WX3dTohpan3CcQaOg1RSVuY3BhQGqKeExiYIKRpyQ5TGom55I9p/Bvqko1auNYJBd1WL5KA8DDGlijb4xnu6AZF4tKcpbIVp0IIrBPI0SnG7si6D4Dzhs+I0OUsZGQi5CCn8oF8NWhitPupwblEGFcXVhcxExwJWr/0uhaPiDQXqsMlMlbrklvKVTnXpmXMeqX+dGQHGcm5ZIse5mfmgQKuSKU92nqVTsN/ra7+dbwF44BHdIKJxRVFpf+mCez3jxLu+Udn8K7JbaS55ufhgO26U+VOcKTXVqdiPaQgwK12YxKhgkhqwLVAZA8OxpDxCk4C1a+17kQAQTy8gicxZmA0YwucgwioqCrP6z/KlOp4tVWvt2kFcJrCW53Z/BbqagVzPDDVkaunU6vNBYIpJ9HDL68nKcsT3KHj3NOA7dDYNEEpv8ssPDYZCJZ8TR2KbtrAZr0aya1wFpue3YP+nW37myqCZCPO4pUYS+xyAUPkpc76E/CMiydqSpdUpHBpKigzBmgxeQaONP78ejoeCzdnPE6T8wt9ZR1NOAEuETfYI2qRqvzpQSm1uKGgu891vcgwBotAZZ0eBFQnbRYtY+p+hdX3iRUIhiqR3Utvph2RxgODI3hloSitO5EwrV+tbC0iNC0+wPj7q2qcE2QouafiGZnLIlbueLIHPUd9OoIMdLkxDFidmglHgjbeVVB8CRwcfKYZ5Lf8lL83i3uAaB1GeDSj5caaYwdaKWUMZ7Kqyc8yA148eEFEkr /Dl3MwfR bvwIAJ+LqSn4TlXIfUJU03PprsTIuRc6AhzthqEQs84Oig20HQo8JFhHWfpJ5rmAayzDhpRdDtsyUYZb+S79KZc0tI9EnfTli/GfG1TY0SsJaSLPr6eKzLk/UM1PhDLAiio65plvT1SR9NBVaHMZ+1oML+z2Po3NjFJIt3ywN96Bk1LU= 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/zsmalloc: change back to per-size_class lock
|
expand
|
Commit c0547d0b6a4b ("zsmalloc: consolidate zs_pool's migrate_lock and size_class's locks") changed per-size_class lock to pool spinlock to prepare reclaim support in zsmalloc. Then reclaim support in zsmalloc had been dropped in favor of LRU reclaim in zswap, but this locking change had been left there. Obviously, the scalability of pool spinlock is worse than per-size_class. And we have a workaround that using 32 pools in zswap to avoid this scalability problem, which brings its own problems like memory waste and more memory fragmentation. So this series changes back to use per-size_class lock and using testing data in much stressed situation to verify that we can use only one pool in zswap. Testing kernel build (make bzImage -j32) on tmpfs with memory.max=1GB, and zswap shrinker enabled with 10GB swapfile on ext4. real user sys 6.10.0-rc3 138.18 1241.38 1452.73 6.10.0-rc3-onepool 149.45 1240.45 1844.69 6.10.0-rc3-onepool-perclass 138.23 1242.37 1469.71 We can see from "sys" column that per-size_class locking with only one pool in zswap can have near performance with the current 32 pools. Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev> --- Chengming Zhou (2): mm/zsmalloc: change back to per-size_class lock mm/zswap: use only one pool in zswap mm/zsmalloc.c | 85 +++++++++++++++++++++++++++++++++++------------------------ mm/zswap.c | 60 +++++++++++++---------------------------- 2 files changed, 69 insertions(+), 76 deletions(-) --- base-commit: 7c4c5a2ebbcea9031dbb130bb529c8eba025b16a change-id: 20240617-zsmalloc-lock-mm-everything-387ada6e3ac9 Best regards,