From patchwork Mon Sep 2 07:21:31 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: 13786844 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 D39CCCD13CF for ; Mon, 2 Sep 2024 07:17:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E3948D0097; Mon, 2 Sep 2024 03:17:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56C328D0096; Mon, 2 Sep 2024 03:17:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E64A8D0097; Mon, 2 Sep 2024 03:17:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1CD2A8D0096 for ; Mon, 2 Sep 2024 03:17:45 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D02C81C66D8 for ; Mon, 2 Sep 2024 07:17:44 +0000 (UTC) X-FDA: 82518943248.30.4CD5A60 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf04.hostedemail.com (Postfix) with ESMTP id 50EEA40021 for ; Mon, 2 Sep 2024 07:17:43 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eXaocgJo; spf=pass (imf04.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 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=1725261416; 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=t263XprIsSxrYEhO7vf/eoDJGVhbUEdYsSqIyXFnhEY=; b=mmPSJsKVCUQiuWwyTf7EmOriVV4PYNkBfqzbJxwA3iDoUkhYz0YnZdeoNUbphHF3cKak+q Acb+ylYtuJ2Q3L5gEisjxjvuTn/hh9tZ9HLg2+yNbc/vmLEahhg6unj1LCfgSgV1V8+r5U ZFMrplkSxAfHMbaQdREqZs8lazF46LI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eXaocgJo; spf=pass (imf04.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261416; a=rsa-sha256; cv=none; b=V9n8fCIwY+oXXVVeeOCtkvwxHw2YuwKF5ixo7OwW4aCQaUJ/ZV5iDFr47s+11tSni+cytv 0d1DyQ5754eB/6HGPUJPA6Hwi5iVQqI12DW8bMV8eDQz47Lg80ttPumL3QER8oG1JTA2g/ nkwpiP5L0STdxKSO7m6n5jIFObLoHpg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A3D30A41710; Mon, 2 Sep 2024 07:17:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3AEAC4CECA; Mon, 2 Sep 2024 07:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261462; bh=CFikcVVBkO0fkQwhPbTnJD5oTr7539f6hYvWeSZonkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eXaocgJoKA1eC/mSBuf6h0+NhqRTKodMvnfs6tgPCGpmDK4W4Jfjf9Czj01vbzrB/ DwYWluMcU0nesvSRU1Oqa1i029m3hnIFjyRTlL7TRvoigsU1Si26+BxCZc1SMjXIrF m8JNHWz09WGPalcymX1yQO9CKN4uFTcN5ZwiKrsNbby8/9FA6yhG34TCuT7gTWM6JZ 4eNIM4jaA9E2e8kdSXAVYxorYAyipYDD1upXQF8a+L4fO1c3qgzq4wHVID461UIOfs gualGxbb0eMWhlydjmBwg9c78Xyb5/cKmORueJ+b6iqsiOJdA1wuJN/Osv7wlfjcdS AHBIjdJyXo26Q== 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 20/21] mm/zsmalloc: introduce zpdesc_clear_first() helper Date: Mon, 2 Sep 2024 15:21:31 +0800 Message-ID: <20240902072136.578720-21-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-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 50EEA40021 X-Stat-Signature: uo6kpf364ix3effy36us64eeaut4h1ja X-HE-Tag: 1725261463-3798 X-HE-Meta: U2FsdGVkX1/HjefVYL9QDAO4FS0Cf/N+UnhZm35oRXFX0doOGgA5OndDRjxXPrk4SG6YY40u55JHzCrVFWHAxYxarPZDZHyPnJTz/bHb5U592TZcozjRat0zL8bbzVuMFpYBKShdcv/YhT2j+jI2/gPR55lt1v5Aoi4c/oDIfsbbZ+9Gfuk9P7LxxS9DWsraDnAqK/gd6ag9bzDpHgeZcFll6yWAbvYAuV78qQX8XmZqB09i56BDd3XIoSJAg3Wt4xI2zZRNZ/7mw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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 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 411621f00a02..849f192d4937 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); @@ -832,10 +837,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; __zpdesc_clear_zsmalloc(zpdesc);