From patchwork Tue Feb 20 06:53:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13563472 Return-Path: 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 C2FEDC48BC4 for ; Tue, 20 Feb 2024 06:53:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B071F6B0087; Tue, 20 Feb 2024 01:53:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A18496B008A; Tue, 20 Feb 2024 01:53:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81BC26B008C; Tue, 20 Feb 2024 01:53:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 735F36B0087 for ; Tue, 20 Feb 2024 01:53:19 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 46691160581 for ; Tue, 20 Feb 2024 06:53:19 +0000 (UTC) X-FDA: 81811265718.17.FAD7DB6 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by imf28.hostedemail.com (Postfix) with ESMTP id 69B24C0005 for ; Tue, 20 Feb 2024 06:53:17 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.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=1708411997; 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:in-reply-to:references:references; bh=Nb30dN0oMtkpv5BRdO1dSuW23c79nozgpyzxi6PFz2g=; b=cy5p0dfzZd3dslphx2/ZRjgQdMxDVAvbJRqFlhEvFJHChdfVnzEilgpl1Icc9amtTfAdSg T5X/s2Ae4NMgBqyV67C4JGjKkw/EQI8mWj3RUfQ3L23CsUrI6JwM3pJEGAbHjws/DhHcxo OAJF54+4ME2iNrQAgaNtHc/3kP1GpLE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708411997; a=rsa-sha256; cv=none; b=06q3KBzhbW/YxND1Str15NitldATDam59cFsnkarkh7iwcmy3fxovaTucODsDVMah0Hhy+ ZlspGrjiXI4fq3cMaAFJcMgcgbQmgKG57U++Pua8OehkYQ6PqGJRbUo5diWNwUhK6Ublpu E/26Nr78CwfJtH+3JuF7lsUa51tb3Mc= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.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) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou Date: Tue, 20 Feb 2024 06:53:01 +0000 Subject: [PATCH 2/3] mm/zsmalloc: remove_zspage() don't need fullness parameter MIME-Version: 1.0 Message-Id: <20240220-b4-zsmalloc-cleanup-v1-2-5c5ee4ccdd87@bytedance.com> References: <20240220-b4-zsmalloc-cleanup-v1-0-5c5ee4ccdd87@bytedance.com> In-Reply-To: <20240220-b4-zsmalloc-cleanup-v1-0-5c5ee4ccdd87@bytedance.com> To: nphamcs@gmail.com, Andrew Morton , Sergey Senozhatsky , hannes@cmpxchg.org, yosryahmed@google.com, Minchan Kim Cc: Chengming Zhou , linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Developer-Signature: v=1; a=ed25519-sha256; t=1708411986; l=2152; i=zhouchengming@bytedance.com; s=20231204; h=from:subject:message-id; bh=GQWspwGCFRIlLWu+jB/4L2Vh7hNigRDA/nhdzUelvTs=; b=JNIzIQ9Lci0B3n2FEPHyXk1U9Zo0P03ME5cMyqjBhp3RwTxfdYX46ff3p2X/QxYJ6NhSNNcY7 4xNL7yvbvQYC/xjoY/qcI71XYnv5VeaKzisgJeRm5rlJnnYxTN/4tk/ X-Developer-Key: i=zhouchengming@bytedance.com; a=ed25519; pk=xFTmRtMG3vELGJBUiml7OYNdM393WOMv0iWWeQEVVdA= X-Migadu-Flow: FLOW_OUT X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Rspam-User: X-Rspamd-Queue-Id: 69B24C0005 X-Rspamd-Server: rspam11 X-Stat-Signature: w7ukkx1iw4z1iugkfcdkwc4rdmoufibk X-Rspam: Yes X-HE-Tag: 1708411997-601421 X-HE-Meta: U2FsdGVkX1+g7kKJx1PmaEovL05ayELSRkHuXfygGg5n+INp1blk73PAo4gu1iBm/QCAnv9i6EIUJULu36GKvJ6foY/tnC4jSZFXT/pr+6Qr5NqdY0clp84umfqbich5JflfoHqnMOkO8KpV6h9UXGctF84STpIQLKY0zXQ1HYW1Co0K95j+T4hbCqE4z/lLjqwo8mTK+fda7ckqgHjxYt5CcL3IqF9GQ20KG/UDb7W/xeg8OgVQpC14nLwI18r2sfIkC83t7bM6bj6kHI25jeGMQRa5fdOBE9A37EoFpeHwJRRjbv41nQ5+ES4WNIPSbEA8PN+T2ypCQeOxeu14v/qJExobNXGIjJ7kZacUfRcAfoM9sa+ByPNkn7+DyaXdMSk4nU6Bbpa9nLHQfwjRBZSO7ZghRfTM1b7URQYBKcLvY6SvXl7v15UVJ+8RTWvJJdhjzeUXiRiXzqztVTWwdV4mvmSbG8JqtMFxiU5qHbX+SeajXF6xwpXJT+22UTexjNB0GPkUQNOkynixAjHUCdf8MziUEdCsSpyf7iM8OTyB00Fop5woIImdRGuXY6Sm9b/87J6IP1qd64mOu4e39EVet1dv9bcAGFC6mUJNmiCwkNb4me8qvB4qrejhwElXs6Q+iGO0O7Ap/mdI6e2A4Zt3GyWVbC9bXbZ5Dr2fj6AVHL2AFqTUoQh3I9gJUpv9ptSzGvXVaX3jlQemijvAroR5GvQ+/UtXnGvHwH73eZ11g2jiMS84eSFG0fAhjiR1B8Gv++YTolDvyJuDeIgjBmQOa5wd7FEELOfT9ppJNjQQk1BgU9kYqzKLL0Svx39Pn1f2oBiriTj97sJZKBHaVa+kYPU9TsMI0bP0/NB8klSbgbV9GBmHoCRfdnLBzN1YA1paAsOlcS1270utNJcCrntLblAbVbcnTALzRXhgTEeIhasc23LJWtSC0VMK6zVppU06Q4oP2IcpVP4/4Cv qbWKQOBb FqUinY7tPaYncxmPpDPll6Knm+0B6RGeidxuw3qxRH7mR6wTUIzhKgt7TN2BiGESalA7JvdwkYcWmGTopQDS42/QsAMnpTeZ4MqYeOf+Mk3NG0ukNdL5x3I4WG8jXXCBBIXLdNi1akIkcALgKNCdxxGOoO3mHMmz3sdg240LFL51d7KVSpmY3i1aEtdHB+3nWtl7mFwiKosFtSoTh4FS8tDcys+r2T0NWqA13vK/omdcte7J9WtRtciBZRmH3wwJGA6RGP0ej1CCG7g7YnqPM7hS++AOiRS6eaCy1HRHVYB02Alcx/juaprQ3UkCeIoWf1MvMGxyckAWeFlAqLRVXLZb8KxLIx8NQB6IoC0GSLNnowUk= 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: List-Subscribe: List-Unsubscribe: We must remove_zspage() from its current fullness list, then use insert_zspage() to update its fullness and insert to new fullness list. Obviously, remove_zspage() doesn't need the fullness parameter. Signed-off-by: Chengming Zhou --- mm/zsmalloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index a6653915bf17..c39fac9361d7 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -687,10 +687,10 @@ static void insert_zspage(struct size_class *class, * This function removes the given zspage from the freelist identified * by . */ -static void remove_zspage(struct size_class *class, - struct zspage *zspage, - int fullness) +static void remove_zspage(struct size_class *class, struct zspage *zspage) { + int fullness = zspage->fullness; + VM_BUG_ON(list_empty(&class->fullness_list[fullness])); list_del_init(&zspage->list); @@ -716,7 +716,7 @@ static int fix_fullness_group(struct size_class *class, struct zspage *zspage) if (newfg == currfg) goto out; - remove_zspage(class, zspage, currfg); + remove_zspage(class, zspage); insert_zspage(class, zspage, newfg); out: return newfg; @@ -878,7 +878,7 @@ static void free_zspage(struct zs_pool *pool, struct size_class *class, return; } - remove_zspage(class, zspage, ZS_INUSE_RATIO_0); + remove_zspage(class, zspage); __free_zspage(pool, class, zspage); } @@ -1609,7 +1609,7 @@ static struct zspage *isolate_src_zspage(struct size_class *class) zspage = list_first_entry_or_null(&class->fullness_list[fg], struct zspage, list); if (zspage) { - remove_zspage(class, zspage, fg); + remove_zspage(class, zspage); return zspage; } } @@ -1626,7 +1626,7 @@ static struct zspage *isolate_dst_zspage(struct size_class *class) zspage = list_first_entry_or_null(&class->fullness_list[fg], struct zspage, list); if (zspage) { - remove_zspage(class, zspage, fg); + remove_zspage(class, zspage); return zspage; } }