From patchwork Tue Aug 13 08:45:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13761560 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 0C56BC52D7B for ; Tue, 13 Aug 2024 08:41:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7C7D6B00AD; Tue, 13 Aug 2024 04:41:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAE776B00AE; Tue, 13 Aug 2024 04:41:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 937D36B00AF; Tue, 13 Aug 2024 04:41:52 -0400 (EDT) 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 625FA6B00AE for ; Tue, 13 Aug 2024 04:41:52 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1B7E71406C2 for ; Tue, 13 Aug 2024 08:41:52 +0000 (UTC) X-FDA: 82446579264.01.6C63857 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 80DAB1C000D for ; Tue, 13 Aug 2024 08:41:50 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Xo7gB3Bq; spf=pass (imf21.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723538440; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=z25iHKcWSinSDIeAECI3R1jU/7muqXwjZWaq6uW8gek=; b=nAQmnYt0qIARP3en707q5TbStIVr9waY5N7ZUUvw2uNo3gqenesmqnF2flVKA/yWCCjVYN xRP/V7VPIZDOPQMVJDzdvWRsINAuQvD99gQcnC2c7IYZ+P0Q/8/P8xXFnoixKZubOXjUFr vblRI0Eg1uQ14bSPgy5dwYgwweW+1yQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723538440; a=rsa-sha256; cv=none; b=63n1CJkzml2z77dS1sBNH+NLKTBhZLPonbpQeoyvkwuOA3UkuVNfGjPw65u/OyUcXX2uvZ Ik3FxhyigGhmQm9YeLw77sdXuqPQVmJ8o+zK08GVVQT6OjgqMxtcO5O0lX+42pnmVp6bEb G54F2iGDApC61DD4kX/S/DB+VLlShlI= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Xo7gB3Bq; spf=pass (imf21.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BF16E61057; Tue, 13 Aug 2024 08:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D8E3C4AF12; Tue, 13 Aug 2024 08:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723538509; bh=43XgPIuMdTYjompc4vGGiVQL8qZrEOEuMCnAM7TFR7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xo7gB3BqFWVM4It6qj2lRPdZgFjGIcIeJ/86oumVRtJApctRnsQGjwaEQPKdxMvdd MIjd+B5OVxXlzcGCXoZEk19wwJ3ilpyb4FBBmyoWbikJ/vlYyjgxOR2qyRs2xsJ9jh iXar1Zrpgk0vDVxw1cUMmGUgHjZbTZk5J+utPy+6t3/0MCdFiLgdWnUEKw2G4UJRry IN2pWUO+/6I0YChVjnKMQJyZTj3WiSG9RlNiPrlV7UFTJG92WEm4irz8zk14pmPVYS vkJQj3Rarc8ig0DecFxTs6bgMD/6IU+9OxCfzbfLdQztTGMrRIddglPt1yIUMHeNsk 5GoTdMIMtC6/A== From: alexs@kernel.org To: Vitaly Wool , Miaohe Lin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, minchan@kernel.org, willy@infradead.org, senozhatsky@chromium.org, david@redhat.com, 42.hyeyoo@gmail.com, Yosry Ahmed , nphamcs@gmail.com Cc: Alex Shi Subject: [PATCH v6 11/21] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Tue, 13 Aug 2024 16:45:57 +0800 Message-ID: <20240813084611.4122571-12-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240813084611.4122571-1-alexs@kernel.org> References: <20240813084611.4122571-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 80DAB1C000D X-Stat-Signature: xadz4nu4iq9m3rrkrgpuyinmkd1a4x6a X-HE-Tag: 1723538510-832638 X-HE-Meta: U2FsdGVkX1/qtTRcQW14BVF+4/nGzmA4swGWOo+v4g49MCLp+hc4KkhQ90QxNA2/QDLfT/QSpDytkCPY5EexXFLLvGsghsesAjpoiE+5PkggtoNUL8n9wW+dwkaU5kqPIdQMtyyft2yrYFm27W1/rYnMwxQX//30iZNlfZJ9Ds1GnKsbUTIVfPiwrlpMCmZ7/qmynaaA7b+qKDawdtv0lWBl+o+ae1wOi8DTqKAVNpek85xeEDGds1OmkFsQ5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TP+fUmWhzm0Kc1IeqdsrL0kyw= 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: Alex Shi zpdesc.zspage matches with page.private, zpdesc.next matches with page.index. They will be reset in reset_page() wich is called prior to free base pages of a zspage. Use zpdesc to replace page struct and rename it to reset_zpdesc(), few page helper still left since they are used too widely. Signed-off-by: Alex Shi --- mm/zsmalloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 65c4252412b3..6c5dccbc9a60 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -859,12 +859,14 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj, return true; } -static void reset_page(struct page *page) +static void reset_zpdesc(struct zpdesc *zpdesc) { + struct page *page = zpdesc_page(zpdesc); + __ClearPageMovable(page); ClearPagePrivate(page); - set_page_private(page, 0); - page->index = 0; + zpdesc->zspage = NULL; + zpdesc->next = NULL; reset_first_obj_offset(page); __ClearPageZsmalloc(page); } @@ -904,7 +906,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class, do { VM_BUG_ON_PAGE(!PageLocked(page), page); next = get_next_page(page); - reset_page(page); + reset_zpdesc(page_zpdesc(page)); unlock_page(page); dec_zone_page_state(page, NR_ZSPAGES); put_page(page); @@ -1893,7 +1895,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, zpdesc_inc_zone_page_state(newzpdesc); } - reset_page(page); + reset_zpdesc(zpdesc); zpdesc_put(zpdesc); return MIGRATEPAGE_SUCCESS;