From patchwork Tue Aug 6 02:23:07 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: 13754337 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 CBF70C3DA7F for ; Tue, 6 Aug 2024 02:19:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FA216B00BB; Mon, 5 Aug 2024 22:19:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A8B06B00BD; Mon, 5 Aug 2024 22:19:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44EAE6B00BC; Mon, 5 Aug 2024 22:19:15 -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 244D56B0083 for ; Mon, 5 Aug 2024 22:19:15 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D9E351C4F96 for ; Tue, 6 Aug 2024 02:19:14 +0000 (UTC) X-FDA: 82420213428.06.2F53501 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id D21D31C000B for ; Tue, 6 Aug 2024 02:19:12 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eogsWgAJ; spf=pass (imf18.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=1722910691; 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=b8F0v5gWthfH+h7xRuT9XYpictXvzfJNloRRGZ5+SHM=; b=7mdmxstkIitFWUtS++fOdLmZdS8X5VF4SYZZHWyyZG6ngo0QMR6g1/s0mEAXt1HytQ6YQL IwnIjy8gofUoArVVW8yYkIFLhzyW55WMUI7ANdi369M2Gjr4NrHgs/87TrZgzB64WmMP4+ O0d5wOkQ0r7GZYvWoiFR4l1seVveFQo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722910691; a=rsa-sha256; cv=none; b=vmaupF/2yTye/paePYJBJwpQLKM9HwCGKoIX22ZzfHY4MHhEN7uYW4CUb+AGupfww0sxXU ywh4Ias9hMwP5eNpKycmbgzLoDdmOvQyrZpOVI4eSSJJ00kNidaVW+tKL5oeodzn9myv78 BV7pJXI9wqPB3Qmop9Xgq6W6GzXC9js= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eogsWgAJ; spf=pass (imf18.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 45215CE0BB0; Tue, 6 Aug 2024 02:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E4D5C4AF0C; Tue, 6 Aug 2024 02:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910749; bh=SIgiyPCW8QCBZtqr5fnMzvbajnde7CasC3gp99UMX7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eogsWgAJOVMVgMm+88DiD7XkroE1wr8TVvpEQjp6NmnLl30eBFsFWj/nQJK+I8c5I jUhC6+ElxHccYMtnUAdfDvOCrIXJ1xMAi+HSzAgR5yAn1y686RgXFAQo4iYVVx44kJ dBNVnqwpiPqTyTKh3OA5LoUrYXaseNQYH3N0a+Z8E9/IdcZJ72fPC9/LMMjOC5NpMH h46X+x/17nvesgtbZ3mxjDf/f1XGF2Wp8TGFIPucQKhRAFPIUBJxVLCHLlEozMXN/2 yHKU2MvKQY37DOnJnxKAUQXYl65JxIApCyH3Cvfj9VuUr49mJFH14C+pH9E5/7j6Ly xUWeJVNSWL3aw== 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 20/21] mm/zsmalloc: introduce zpdesc_clear_first() helper Date: Tue, 6 Aug 2024 10:23:07 +0800 Message-ID: <20240806022311.3924442-21-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D21D31C000B X-Stat-Signature: j7tmfknn4stefai3umt4qn4bzp9o95us X-HE-Tag: 1722910752-441154 X-HE-Meta: U2FsdGVkX18WMo9JreE2TcuN7kp8K/OqRvvNACJ8aaHMx+TOvXheVEaSej24V840ckBI6L7SRvat6JqPm3TBa/fxTyjR7Nqkibr/v7kRNoWk8mvIrkM/GJgj6ZpVEVsRjfdsZrrxfRyalT5Pd3cqL7hhx9/AXgYm7W8Fa5mF27OqwMa+Hsi4ZSdfNlG7cTQCJlLmkhh5uOs7Fm6EHGIy6NpeeDZT9hMUFmK86cKiKfKeY//V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y3OI/6epXpuzPv 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 0b318db894a8..e92451c6b69c 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); @@ -824,10 +829,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);