From patchwork Mon Jul 29 11:25: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: 13744743 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 63BD5C3DA70 for ; Mon, 29 Jul 2024 11:21:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AEFE56B00B8; Mon, 29 Jul 2024 07:21:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9E116B00BA; Mon, 29 Jul 2024 07:21:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93F336B00BB; Mon, 29 Jul 2024 07:21:26 -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 6CB076B00B8 for ; Mon, 29 Jul 2024 07:21:26 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2FE0A1202D2 for ; Mon, 29 Jul 2024 11:21:26 +0000 (UTC) X-FDA: 82392549372.19.A148701 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 1C42A40027 for ; Mon, 29 Jul 2024 11:21:23 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="NpQwJ0V/"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722252041; a=rsa-sha256; cv=none; b=E+kx1yYVjMR5GRSxq1Hm2SUQEQ6gCwl40fZTOkZx8DKsHJ8xMUTAgQCe3LNmdvrmrIgobL HlNgVqBC5N4OcHSrU0e/5yNS7FTAVynNzJSOMcB5IEI0khHuyVAcgcBqf05c03pNbQFd6/ +FP6c4Ys1yh808tbosUH734MRuU77D8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="NpQwJ0V/"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1722252041; 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=p0QIqgbhoMoSNPXNsrBhFeM+VqFxoSiKdVrme93wtPw=; b=tcj7uvpJ33a9eUBvCDxX670K2lLRmgK3Jg8Mmhu6qaIJy9B1GmgPJznVxhLIr732SrYigq 7Lol94qIak9EqE3hgtXA4UprcfKwvRsrKsDZjLFtyynckiBIy9eP8SrCBxmhQW1gC1jU+P RzscazEK27TpWDfq7Byc0WToOJBO3cA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7342CCE0A1F; Mon, 29 Jul 2024 11:21:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7CF5C4AF07; Mon, 29 Jul 2024 11:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252079; bh=PC5jkQnfMoZxwZVAO0ES1OaCQkwLNtrVhI+Kr1f/doM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NpQwJ0V/9xj+pd3NV/uPFqOuWZuUCH5VTltgNIR8JOiw68vnQc/mmjRL0R+hJWPxS Dqj7sdu4p9fgtW71tq2acbFtvgIwIS+KcTUjHrotVN/yVR/dZRkf2/NTlNH88FSujg vs/cboP6T/die3KPnUcQ3a7vLIHFQAd7vhxELPhr0uAgH0yLI9u4oj4KCueAQQtQ+j hfJa1OSHq5027FOLujL3t3jPAv+nnvPLuFDnOI8ZBS8pVQPq+XweejJbEpa+AAFBUE 9ODKZcowCZRBUoWE/Qunc4kTxmTQBQGxTG7Ktvz9eiAMTsjs7iqp18x5xpqq67Z7H0 NU6nTU1sOW4uQ== 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 v4 19/22] mm/zsmalloc: introduce __zpdesc_clear_zsmalloc Date: Mon, 29 Jul 2024 19:25:31 +0800 Message-ID: <20240729112534.3416707-20-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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1C42A40027 X-Stat-Signature: b6prdr5ag8zoywahz8d1gcbw5dqf9dg4 X-Rspam-User: X-HE-Tag: 1722252083-667150 X-HE-Meta: U2FsdGVkX18Sqvi/UsvpAMFh1fVGEbRu2pJggoJ6AzUyVLOgAXOihoNUoRvxcj1F658levGoFTWtHoSAYKZPtMbqiLI9MOdvETW2Ds+GlCn0ZQU+j8qeURtOLaoggfCde4jINC0qyTkKrqeAv/gBZfCXrdLikh8rvK3/PF7NtxVVuYsf1Clnvl8++XuBc5A2sR4QmC84gWTiR0Ram2QLSGVGiRPj5fg6hV6Vs0lLG4RiB99nCM6ugec04zM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osity: 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 Add a helper __zpdesc_clear_zsmalloc() for __ClearPageZsmalloc(), and use it in callers to make code clear. Signed-off-by: Alex Shi --- mm/zpdesc.h | 5 +++++ mm/zsmalloc.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/zpdesc.h b/mm/zpdesc.h index 5db4fbe2d139..05def4d45265 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -119,6 +119,11 @@ static inline void __zpdesc_clear_movable(struct zpdesc *zpdesc) __ClearPageMovable(zpdesc_page(zpdesc)); } +static inline void __zpdesc_clear_zsmalloc(struct zpdesc *zpdesc) +{ + __ClearPageZsmalloc(zpdesc_page(zpdesc)); +} + static inline bool zpdesc_is_isolated(struct zpdesc *zpdesc) { return PageIsolated(zpdesc_page(zpdesc)); diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e1d3ad50538c..d88602fb0233 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -851,7 +851,7 @@ static void reset_zpdesc(struct zpdesc *zpdesc) zpdesc->zspage = NULL; zpdesc->next = NULL; reset_first_obj_offset(zpdesc); - __ClearPageZsmalloc(page); + __zpdesc_clear_zsmalloc(zpdesc); } static int trylock_zspage(struct zspage *zspage) @@ -1024,7 +1024,7 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, if (!zpdesc) { while (--i >= 0) { zpdesc_dec_zone_page_state(zpdescs[i]); - __ClearPageZsmalloc(zpdesc_page(zpdescs[i])); + __zpdesc_clear_zsmalloc(zpdescs[i]); free_zpdesc(zpdescs[i]); } cache_free_zspage(pool, zspage);