From patchwork Tue Aug 6 02:22:58 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: 13754328 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 2312BC3DA7F for ; Tue, 6 Aug 2024 02:18:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A17C96B00AB; Mon, 5 Aug 2024 22:18:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C73D6B00AC; Mon, 5 Aug 2024 22:18:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 867E26B00AD; Mon, 5 Aug 2024 22:18:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 642766B00AB for ; Mon, 5 Aug 2024 22:18:41 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 135E416193B for ; Tue, 6 Aug 2024 02:18:41 +0000 (UTC) X-FDA: 82420212042.21.2F8BD00 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf29.hostedemail.com (Postfix) with ESMTP id 1B63012000F for ; Tue, 6 Aug 2024 02:18:38 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eumQagZu; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1722910657; 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=a2/GB7+WY56RfUVdcNlABSbDEOw80OJBksB/qmP2y4E=; b=HQOLDuic7l8XzUSBkAcFdRSMYWmzbSqWaz9/7Tsk3awJg+1Ukuf9KV0cTEhy/7SU8KaL3V Sb7ohOau46mE8AEyt1gO695Oi39BO+2C9J/iJK4jJYVjfBmVaKKdEgLdWWtov0LWPBUD0l S0lidG5VPrHhmdVP87AIuy6zoUioBZ0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722910657; a=rsa-sha256; cv=none; b=i8fu5fxXhtw3rE2hCxmq2Jf7bDDTANTzSgl4ot3Q9F3rU5h/GfGoyJwyWDjvMyAZKa6ylK UNoxReoiUg0bTuCyZzKngfQ2fGuX5VyYAm8bATVxbud+C/GbOLbvBgIaAX0SANuIdyYT7u etJO70c49X4RaUE1Fr2rYiW/ewd46ss= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eumQagZu; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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 sin.source.kernel.org (Postfix) with ESMTP id 9434CCE09AF; Tue, 6 Aug 2024 02:18:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB7A6C4AF15; Tue, 6 Aug 2024 02:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910715; bh=lIAmwXpKjxS2Hsoj/dTwcnmyf7UY5ner31n75hmLtY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eumQagZuRPiE1JGpb1pdxG+/99Ht5pD7RRzlqeURY/va7iPdIX7vB4gKhr06VJQ3r UWoA8msGRp4eA8sccL2/GzO5mQxkVqzheMiDuAC3F5rJW5N+SCFZtKyAtFO+Lf67rc KTHxlNvMvXZB/J55XLBEOsY745Nro5/dQ9+M95DGwMx671Ot4J8rtSAseOVLtktMQF oFfqu8itoW6TWi2Fvx8KvB0l7TgUW74oWiWh598DDOWMLJ7jNCPpg2iwUlurfumYlt StcwxXKGxg+yrDJ9bj0qQnx/7/ncGtbXfNpvFRVea1X2Pg4QthRUrw4kec6lJhMnIZ D6Wh2QaMAul8g== 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 v5 11/21] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Tue, 6 Aug 2024 10:22:58 +0800 Message-ID: <20240806022311.3924442-12-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806022311.3924442-1-alexs@kernel.org> References: <20240806022143.3924396-1-alexs@kernel.org> <20240806022311.3924442-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: fjfnp4qdw1bo98pghb1y5qn5g33ryau8 X-Rspamd-Queue-Id: 1B63012000F X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1722910718-100412 X-HE-Meta: U2FsdGVkX18fB1E9STzZHcHNkzXCN36Ral9R/3JJjjofttRKARng7BxEK79o9LHxoVDkGEdqz50aENh2pFobbHT1wLVJuMYzwIEcCSJw3gKAtDWitMr6ChnBGiIRBayL/3kyyS2p7+ZUUkdTpj0VQdCrnH213OaW8+kJbtv6f2Q6GgCqhTjlE8QiTH5fOZuxjYt6uvTKEvum7GQx2CqbdN1Xnn5NjzY0Dfvnqki5d4Y5taiI9O/e0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YGIP 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 398b602a3b4d..f4fc79c0bef5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -845,12 +845,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); } @@ -890,7 +892,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); @@ -1879,7 +1881,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;