From patchwork Tue Feb 20 11:44:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13563907 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 54F5BC48BC3 for ; Tue, 20 Feb 2024 11:44:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59B866B0083; Tue, 20 Feb 2024 06:44:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4880D6B0088; Tue, 20 Feb 2024 06:44:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28D666B0089; Tue, 20 Feb 2024 06:44:46 -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 0D7256B0083 for ; Tue, 20 Feb 2024 06:44:46 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D408B12068C for ; Tue, 20 Feb 2024 11:44:45 +0000 (UTC) X-FDA: 81812000130.14.52C154E Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) by imf28.hostedemail.com (Postfix) with ESMTP id 315A7C0005 for ; Tue, 20 Feb 2024 11:44:43 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=g0nQyEhc; spf=pass (imf28.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.187 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=1708429484; a=rsa-sha256; cv=none; b=oQi8HTbnI+Xaq+LsenFu7XI0gZrSDlLkiATyCyP7kRkuoG8Q+W2+W0vlQwNeon5pmhiwhz SwXdDk+Py7inUepZ5ByJW2A7wyv5eqoplC6B8h3I+6NqFXybzf9gPAVsshbzU2Lo3Y05h8 Xek707nmA3gMqYb25UN434CSRPQ9GiU= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=g0nQyEhc; spf=pass (imf28.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.187 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=1708429484; 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:dkim-signature; bh=frGjyVgHupGD7XyoLjuBNXl6egeagHTj4tQawTxfLDk=; b=d5lkO2sQYKmQG3gHWuhKKcuuIeQwS1CBtuxCHoFcqAMLM6v2uaEo1FF1o/PapU8uo93Y3w fp1Oz75nmzrUMPE/JySQyEWy+n1NfA44mPWxW/iS8R7jnyUCTNK9ASXbPafASSd/IHgZ8J IkolDdfAVr5fIfD1xzF0iJaLOlSW0DI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708429482; 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: in-reply-to:in-reply-to:references:references; bh=frGjyVgHupGD7XyoLjuBNXl6egeagHTj4tQawTxfLDk=; b=g0nQyEhc0uv+uyH42ziPQ1j9bhr8hQRZCCD1pT3uRaE0h01LgIKi7xFEjBfKNbh47w5tba emvlznq1s+LOnT3Lw9TXWIogMbzkBgFeeOLy8fgJ2ioyd72Q8p+oL3w56Dqvf7WbgzC07F xS30vIqd5dGOK4fSMvu6DsMCjzJH//c= From: Chengming Zhou Date: Tue, 20 Feb 2024 11:44:30 +0000 Subject: [PATCH RESEND 2/3] mm/zsmalloc: remove_zspage() don't need fullness parameter MIME-Version: 1.0 Message-Id: <20240220-b4-zsmalloc-cleanup-v1-2-b7e9cbab9541@linux.dev> References: <20240220-b4-zsmalloc-cleanup-v1-0-b7e9cbab9541@linux.dev> In-Reply-To: <20240220-b4-zsmalloc-cleanup-v1-0-b7e9cbab9541@linux.dev> To: hannes@cmpxchg.org, Andrew Morton , Sergey Senozhatsky , nphamcs@gmail.com, yosryahmed@google.com, Minchan Kim Cc: linux-mm@kvack.org, Chengming Zhou , linux-kernel@vger.kernel.org X-Developer-Signature: v=1; a=ed25519-sha256; t=1708429476; l=2152; i=chengming.zhou@linux.dev; s=20240220; h=from:subject:message-id; bh=GQWspwGCFRIlLWu+jB/4L2Vh7hNigRDA/nhdzUelvTs=; b=HfKohdQBHsp+yH25vS97QDG5EljLYcLDRXNqctQwnwKj01ORLuWu4tU2UdBSKwG84P3sebhh0 +EDf/e7QoXHDzKOZQ3ztPMFYVZxHPOhdOxb/wSKcAv5ObGPWQggBTCa X-Developer-Key: i=chengming.zhou@linux.dev; a=ed25519; pk=5+68Wfci+T30FoQos5RH+hfToF6SlC+S9LMPSPBFWuw= X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 315A7C0005 X-Stat-Signature: jpq4p5ag95atiiup3i3hmyrxxg1d7djn X-Rspam-User: X-HE-Tag: 1708429483-258807 X-HE-Meta: U2FsdGVkX19t95GowxJ1qagaoefa3k5J0Xm8vCo0lJJQRykf/BuH9vqoPQssIjmdirAN8Otjwkk2jJBLYkfGQHETbFvDjtTr/fAYDFi0il7craHewliZTJhV1OdhORPjesmGkdGcZf/4uzx0y2WxN99rbqj7VCN7epRDn38e2PmX3oK/IdeCDJFuSr8cN9FqQOK8jUUhxUA0efxUEzGoQTawRMe/G0eIc9NSFFaGrMIEXUGHy5d/jpkJa6TOjNif77WN31ZMkFFMNgl0gmFYAoK0odzjqn4FNfjUTCRE9tfaYI7vi0UNkLH465yGPjDW2od3N9Z/iOKjjph4wusvsqI/iyrv02HC02HPbKpMt8+zhqxCt+5kNnPnflAUArsHIRRIl9sWBJi+R0DnEpF8IqA6ZK2EekhxfuPChsdpv3IpQ0T9crlQXY/8SnLPsmMAFuL90QIifsFcLrWf5BJZRkXOYGAw17HStQZS33MWvXPVVuPgcqsnj7uSXwbyNSa1gFZ8+YBHQtNfQEHSfhX4XY/NZjre8rTZH+9FKfmVIHhaTZQFhJMkhbBMO7EGRabaE++/4Hg03likHpJmva1QSPpsZA0iZtZ3Ydul084ShaWI6F6XecQOQ+nYNGC0rBPP3BXpsYUqkc/JbMGY4Iuy4ApKt/FLBh8ZYmzTHyHEt7/q1SNI1P03iRxZPoeJKbfF7BeCkN2nQ734ohz5/tmt1ih498ywfnaUNbIE/NIeWQ6TUCuefVm3unLMcxEnh2iIHbLDGNHLLvVGVr4s9rgNpCYvOS6fBbnk2gQnQq7VR3KULy5IH6w15IicHknhLANsxAheHEnzT0ti1uROLgbsiIXeO/nBMycs 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: From: Chengming Zhou 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 Reviewed-by: Sergey Senozhatsky --- 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; } }