From patchwork Tue Jul 30 12:31:57 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: 13747346 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 B938AC3DA49 for ; Tue, 30 Jul 2024 12:27:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C2946B0088; Tue, 30 Jul 2024 08:27:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3721F6B0089; Tue, 30 Jul 2024 08:27:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23B166B008A; Tue, 30 Jul 2024 08:27:46 -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 04E3A6B0088 for ; Tue, 30 Jul 2024 08:27:45 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9F27A16029A for ; Tue, 30 Jul 2024 12:27:45 +0000 (UTC) X-FDA: 82396345290.29.6CF300B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id 018DCC0020 for ; Tue, 30 Jul 2024 12:27:42 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CL4YamNW; spf=pass (imf28.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=1722342408; 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=0Zue9HC98XpUEOekFfNgJBL83dFJyjOO75Yl4tyINhk=; b=WXdXDK+87y+n8mMsUhIRlrQr+TDuGFX+D0ZuNlpBEKCtdV/3fmeiGhumaFSLKmLc3Fc6Y8 BI4AwGlSkbs5JTDOBU3CBxxBtA2hwqPsiiRtWLztz6K8n6k/ZoC047OKFXUags2ot1LEse vki7B9hyphnqIQjYu04e94x8RgH82Jc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722342408; a=rsa-sha256; cv=none; b=jsNkUPBOpub3N9uRCaUac64g7tpU9WP8g5DFU8tBrauMBv7d1QX7NLc+v0zDLxRZV2CPpW 83pI5cEfxZBfwZpajHP3Dx8DdWVfUGHLV7pXWXg+sEIU+dUaRshBVR6Yok6HXP9e1mwggZ MROXW0DWCkOBAsVmCfR5xAvI78BdRo0= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CL4YamNW; spf=pass (imf28.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DCC4061E46; Tue, 30 Jul 2024 12:27:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BC51C32782; Tue, 30 Jul 2024 12:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722342461; bh=rBOTxVukObDt26c+er7K24D5TzmL/+0zcqF1Wh3ZGHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CL4YamNWq/Sh4OpNbR8MweHnWdrmkAREEsaoqPREX07MePcgTdhGqtesC1js1Awty qc2hh95WqP5Pu2/aFf9j/Xg+TNY67MMwk9HzZFVMivzAFZogpcGCd76qJ25KXj82d1 T3vhlM//Y30II7zafEEvIifpvK/iPqFtr5k+J9fmGCHE9rpIKuPbur7mU/3eyUg4pz VoPNv5r87i0T4jm2kHnDon8VU8AJG4VUOBIUvTgeDhaP9Ym5aL6N1B0iMt2ExmNbnt QwzHKMzrZVJCeO6AAliH+4JF/TsjzXH+2OkCp603oaAukOdkyqqSWT7Iv39JtP/ULI 1KluTFaLBQB9A== From: alexs@kernel.org To: alexs@kernel.org Cc: 42.hyeyoo@gmail.com, akpm@linux-foundation.org, david@redhat.com, linmiaohe@huawei.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, minchan@kernel.org, nphamcs@gmail.com, senozhatsky@chromium.org, vitaly.wool@konsulko.com, willy@infradead.org, yosryahmed@google.com Subject: [PATCH 23/23] mm/zsmalloc: introduce zpdesc_clear_first() helper Date: Tue, 30 Jul 2024 20:31:57 +0800 Message-ID: <20240730123157.3761782-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240729112534.3416707-1-alexs@kernel.org> References: <20240729112534.3416707-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: j5ru6d4gxgnxu5gtk4g8fe4r8q5jt81m X-Rspamd-Queue-Id: 018DCC0020 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1722342462-524369 X-HE-Meta: U2FsdGVkX18wCSoz8NZXc+pIEMIrXTweX3/a1y3Al+9Ln3YPgSdvJn5AAtZoTZvEejHuqnPQ6jOHKwHGyEc4EC5gqaY5RGhPdrYLkQnXlhUCVFmObmBkM3tSalN2l0W+L6SGoU8eFtisDoBKPvPhaj7lRIKiwodiDOydtVv7T1irBiJ8GVKW806bcwiU9inxzb1ubj6kU+i7XlTNVSHX5iOpnP+bwCreJOGp4fTgH/I9RTAObKDycWcpXzq1MSHftfQu/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dd4H5Wo5nRPEGh1SruCoa59Ro19NIFi6yPrZ4VsRdmCXwPEFqIZhmzg4PmWtUvjIYSy8FL6o3dTxH0q00leRlivsxBwkMo0EqN2nJRLn/Q9pjKQGTWUCO5epAwu+kcf8UHNaiHWAKYTBKvGbr+jctuNcdp2dSlZJtXD3PGXLgM838lbo0hrQOXvulA== 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 To: linux-kernel@vger.kernel.org To: linux-mm@kvack.org To: Andrew Morton To: Sergey Senozhatsky To: Minchan Kim --- mm/zsmalloc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 50ce4a3b8279..731055ccef23 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -259,6 +259,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); @@ -844,10 +849,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);