From patchwork Wed Jul 3 04:06:01 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: 13721081 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 B8986C2BD09 for ; Wed, 3 Jul 2024 04:01:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 485C66B00A2; Wed, 3 Jul 2024 00:01:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 40B676B00A3; Wed, 3 Jul 2024 00:01:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 237C16B00A4; Wed, 3 Jul 2024 00:01:54 -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 ED9EA6B00A2 for ; Wed, 3 Jul 2024 00:01:53 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 975E5160588 for ; Wed, 3 Jul 2024 04:01:53 +0000 (UTC) X-FDA: 82297092906.18.D3A2B00 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id E9E9540014 for ; Wed, 3 Jul 2024 04:01:51 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NpDb5OJz; spf=pass (imf11.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=1719979300; 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=kJQiG/5I+17lbFKCGyYuI+CpVs0RVUWdddaEyCf/eUQ=; b=XVE3MsFtOfyO5XpNrREaig4AhLPsmCSWoU5ZIAS8vA8fB9vHhd1wDhyAXTnzGWl0y2Nyks eXC3HQ7DnG73rWV3VYJlXhNJ4Ga0FHTHQnHp3pQtKYOE+5MMaD0A21vIzjNxvU+XOqeii5 olHtNpYKJhXjpKZwKeYOevVPAdMGEys= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NpDb5OJz; spf=pass (imf11.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719979300; a=rsa-sha256; cv=none; b=6TFgxpFK0ehGc+x9NyocHGsOhdfjLG/n8wvGiIzX96j79DblhRuah5BoYJ7sGbM22EWtDP ULXHTz201yThfFwl9VQRtEaHEICLTLh4DPic0EtD/CU014glwmvuJAyBPmLtD8vi4c94mg RZskuWnXQ8hNTnzlfShACLjByT72Od8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2060C620DD; Wed, 3 Jul 2024 04:01:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF31EC4AF0B; Wed, 3 Jul 2024 04:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979310; bh=d7GxkLwHXdQyb6XsJEXUauGOBeH6/SyL3Iuz9vNzPwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NpDb5OJzKlBHlmXy9eSfpYJA66+cDPSqPT/zmcenz11JqH6X7j4xggFBVksX4hHDr hrjebT56ic9Us0wcGrhTL9GrCCBcw2YKhHWj5Y/X7PXOoNg8AJDlaRCV1/bY5oVTjW 7reZHFTfGlB5U+5CYeaRbolfCWAWin7oIgpneC1lVlHKzPLBeY8NnMzeV6hQm2+Uq+ dyrqduH1axDvKQqlOLJqHrP2wLCJgyLxxzsoUfUu5MC/7ZxEDhAjZdajB8AmIPr8yV YuDrR4c//Kevf275D86Y0FW1sKewkadQl9n708d6mCQmWAu/FzFHMBk7NsFvLKFIyz O1sJ+oFdqQ6xA== 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 v2 11/20] mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it Date: Wed, 3 Jul 2024 12:06:01 +0800 Message-ID: <20240703040613.681396-12-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703040613.681396-1-alexs@kernel.org> References: <20240703040613.681396-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E9E9540014 X-Stat-Signature: x1sx5ap3a66gr43gqhrb3jpy4oxy7h3p X-HE-Tag: 1719979311-632897 X-HE-Meta: U2FsdGVkX19Zk9iEgCeHnb+1+V7PA/vAEVsg3xXn/W2b3/nAtWqv9jZI3b9ZmsonD1q3GcIs64ouczr07A1mxH2OVjUT1a9jeyyR0KWuykJXjwPMzWOrSNqtoFMz58WeoDrolYgsUwBEXVAvA0A1JmXKUYN7BiPzRgvLX7yrU3ZksBplgy1KDHmYjoDUQqdJvpH4uYXUG8u4oWR9C5QvlrJ4PfkUxf10kt9oGTA1JmkCDbVE4iNKjI27VNcFbhZd1u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7 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 9bc9b14187ed..6d1971836391 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -865,12 +865,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); } @@ -910,7 +912,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); @@ -1899,7 +1901,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;