From patchwork Mon Sep 2 07:21:22 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: 13786835 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 0B072CA0ED3 for ; Mon, 2 Sep 2024 07:17:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A60C8D008E; Mon, 2 Sep 2024 03:17:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8525E8D002D; Mon, 2 Sep 2024 03:17:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CD888D008E; Mon, 2 Sep 2024 03:17:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A8518D002D for ; Mon, 2 Sep 2024 03:17:14 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C478B41A1F for ; Mon, 2 Sep 2024 07:17:13 +0000 (UTC) X-FDA: 82518941946.16.2BBA7C6 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 2857F120007 for ; Mon, 2 Sep 2024 07:17:11 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tINHAOSK; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725261338; 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=xXTasWYVXJ4bjehGHqBQUEnrhGISSsBrnqSgl9/TimU=; b=6uv9XdbTpBfMAaufFBBMYbNCHiE8OvOh2Ns25Bc8694RKC3htug7SODr42ip3f8vzpaRjb ENvgsYxdlZxTOXQSOrEmLEBolb4GIVwrJMBonU9FmPNS8n9UA2THcKS+vpbOz+4vsczZ1U WFgAmXtjuGbiqUQ+3oadeL/zgVd3G8c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261338; a=rsa-sha256; cv=none; b=OGjVnnns7yP7vbl/WE1tYvjxZ3a2+oPAo2vVQlS2qBF3bDad435WCOcbljPLu10Hxpm1NY KVeImaqk72pXs47YWonReJbjdGdMJSjo7zE3PUsM4RrBHIQQYx4IqbTV71uGtbpOXx0Bop TufPGuGo9gs/NnCnQdCN85xawt8+KG8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tINHAOSK; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) 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 0B0C65C5724; Mon, 2 Sep 2024 07:17:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59271C4CEC2; Mon, 2 Sep 2024 07:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261431; bh=TqaE/5WJpT1xBdjh2dqdooKapipE1l2P0P7kGVoluZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tINHAOSKO69ja64wk58zkCcRcnjShQs6ujw7E9y0QqjTQ2Y9taiVSVw1xtraDIUOF NzJ4/jDvLlYoO4zZIiSJqmsszuMAbnuyMTsOCbm3B+BJIsl+16BsZ+omQXqmXSglnm v0yWrwoutoQuD4ye6gqAqFgIJmwaWmBXfx+V26fOfvQcdN6QCRaB8Tubehki32vm70 NbcjUFnlub6UuwvekHSYnnKakVcPvNyKfOZ9EjH2oC/AFPoZAGVtaVXAdiHExx3WCi rQciGFPkmq1gCe+us9jvCXv6Fm8P71mQUUJ1oqY7Z2FfKKB2hmIgeUX36hKv70OFoS aL3Y2UJ4+oxiQ== 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 v7 11/21] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Mon, 2 Sep 2024 15:21:22 +0800 Message-ID: <20240902072136.578720-12-alexs@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240902072136.578720-1-alexs@kernel.org> References: <20240902072136.578720-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2857F120007 X-Stat-Signature: 74u8p1ijujmgfweagqnckhgkoac749ji X-HE-Tag: 1725261431-588452 X-HE-Meta: U2FsdGVkX19+F5OwH5fZzO9tKztppGX3Ss7bHR6uZD1MVw0kwDAWNEHpEhIHRP+2it5NbyqCKf+UnseoatqrV4i6O9qKuzmWw4ul9pQ76XDLZPxBc3XL5gc0a4kn0X50v/S1JjQYBwNG6hlhgivjH3exiElQwZTqrcBIfdcZgdFw8gLOsrdR7uu4F/kh5/BX2KjLbUIVlSgqPsGz9t8VQTCMDxVJvElSnCq6mSE2CaWdagkbXdn3mMtJSZBDKQY3kYtkzSTkoXz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TYqyezh93omiJZVXXfe 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() which 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 caa4a7883ab8..b03bd7e07e98 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -853,12 +853,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; __ClearPageZsmalloc(page); } @@ -897,7 +899,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); @@ -1886,7 +1888,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;