From patchwork Tue Aug 13 08:46:06 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: 13761569 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 C6EA9C52D7C for ; Tue, 13 Aug 2024 08:42:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B9AC6B0089; Tue, 13 Aug 2024 04:42:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F1A06B00BF; Tue, 13 Aug 2024 04:42:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 395D16B00C2; Tue, 13 Aug 2024 04:42:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 15F606B0089 for ; Tue, 13 Aug 2024 04:42:28 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BF4094071C for ; Tue, 13 Aug 2024 08:42:27 +0000 (UTC) X-FDA: 82446580734.22.C964827 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id 2B676A0028 for ; Tue, 13 Aug 2024 08:42:25 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mejI+7CX; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723538467; 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=Gdw27DXKth1M/PuiOaBe0oIyfvVPsznflJoc+OFbnwA=; b=mXUH8QsEP3NDsMwQseeTzJUC5J4b2qEMbd+GRsbU7bGUS9V/AeP+6EYKr61BSZl/dLGT5I Si+bmwR90+y6jXEcjya1Ma7SYI6wkhOv9ce1p/YH3ZdFypXlh4X9X68nvLw7cv1RdEJh38 lov7xJ5OojIgIcSrX+rqTch6bWMPtxc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723538467; a=rsa-sha256; cv=none; b=0lGrGmeevhqnVw6aTMENwVNedPDjCLnqHUSphAXlYIb5hXVA7RFqdtQTx1F2mI9Ryr15aO RMCT50vG99Xz/Pu1DpvCh4w2lvrWnBz12iRRNl2I56KUNpIncqGOwXYfZz9oKl28DXd1LZ CHHOJpnmLPULe0heYjrKzoBc61w9YEI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mejI+7CX; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 535A6615A2; Tue, 13 Aug 2024 08:42:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7BD2C4AF11; Tue, 13 Aug 2024 08:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723538545; bh=GGradnuK41+byBnHyefAqZD3LeHddFsDEO4CJxk+f0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mejI+7CXbaNN6QrWv+gyGHDhIeialjnXVUEkoTuuLiEMeYDjaTjw2VDn0SOFfEsh+ vkOy9tq9upX8uw+PGZwrRA7TL02hSe/SSLQu9ho+WBZ/gGhSAi0deOsMzgTWJj0qFK bAPIKaZJNX23wmCL/wjJgJyg+taUjPfBiJicIxiIJnRybb3u38WhJyPrZjzcKFdfnY dJhLNNOuTQDiHAN8zzMxGCNabpnbvFHoiTF8PrCj8dp/ZbafQ/mgFOcm1LRBCL0w4N TAkESIteUK13GxF+JSJWpscWFt5ewHxF8BP4wjSjo24OLkNaugLTprwReAlL22HdVS 6lhrf5QpTGRjQ== 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 20/21] mm/zsmalloc: introduce zpdesc_clear_first() helper Date: Tue, 13 Aug 2024 16:46:06 +0800 Message-ID: <20240813084611.4122571-21-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2B676A0028 X-Stat-Signature: j57h3gmzeigwm88db17f6dokm4mwonoy X-Rspam-User: X-HE-Tag: 1723538545-359740 X-HE-Meta: U2FsdGVkX1/DOqbyNeVKEVBae2nbcRxXAOQbHGkCeTvNcJyGvXyzj11oppdkw6JA3PqJexC5rV2wGDp7ELasq3g6Sb3wLWK1m8MBU1sIBQdUrsZ4Kej6rgpXU9kzNqITpCIzmSbIk1m6+OsC9idQAWIdN1gIeYT3+H0Dpq+gVbzIXava5b5nL4aF2hNKLWUjJn/0hvOtXpwqFH09WsFfNO/rzlP0/rLn5ZJWvbNz/pLNExZij3FUlUfrksRoE34EEVR5wdScAMZB60W1m+KE6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ofilter, 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 Like the zpdesc_set_first(), introduce zpdesc_clear_first() helper for ClearPagePrivate(), then clean up a 'struct page' usage in reset_zpdesc(). Signed-off-by: Alex Shi --- mm/zsmalloc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 6e7cd5acf5e5..3dbe6bfa656b 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -253,6 +253,11 @@ static inline void zpdesc_set_first(struct zpdesc *zpdesc) SetPagePrivate(zpdesc_page(zpdesc)); } +static inline void zpdesc_clear_first(struct zpdesc *zpdesc) +{ + ClearPagePrivate(zpdesc_page(zpdesc)); +} + static inline void zpdesc_inc_zone_page_state(struct zpdesc *zpdesc) { inc_zone_page_state(zpdesc_page(zpdesc), NR_ZSPAGES); @@ -838,10 +843,8 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj, static void reset_zpdesc(struct zpdesc *zpdesc) { - struct page *page = zpdesc_page(zpdesc); - __zpdesc_clear_movable(zpdesc); - ClearPagePrivate(page); + zpdesc_clear_first(zpdesc); zpdesc->zspage = NULL; zpdesc->next = NULL; reset_first_obj_offset(zpdesc);