From patchwork Tue Aug 13 08:46:05 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: 13761568 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 538C7C52D7B for ; Tue, 13 Aug 2024 08:42:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8500B6B00BE; Tue, 13 Aug 2024 04:42:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D8356B00BF; Tue, 13 Aug 2024 04:42:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 651E46B00C1; Tue, 13 Aug 2024 04:42:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2FF036B00BF for ; Tue, 13 Aug 2024 04:42:24 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E4B701C30D8 for ; Tue, 13 Aug 2024 08:42:23 +0000 (UTC) X-FDA: 82446580566.13.878A730 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 42FC2C0013 for ; Tue, 13 Aug 2024 08:42:22 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=e6kjY4QB; spf=pass (imf22.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=1723538471; 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=dTXvl5YBfUlmT0//8duifZ2I6YpaXJ1Po/eYt0e/ytY=; b=VtcKUMFAFkZElT7xXALsa9obwD06txTqI/CJmZISMsEUUn/oK657NfB44G9dLNjmvww/an Y3mZqvyC0V8GfYLXEZWzwPnj2D3v7Ik7z1u/wSq7MlrvxrnDIhRr8m4ZX6u0dggJzRBjet j8qyvUtoetYIFUzO/eYs1QDMh2COJRw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723538471; a=rsa-sha256; cv=none; b=UYxh4c6W6BA8R/h15AySdJAEPFoSfO4psX8DVvvae44LGP2vK/wQZ3T2CkV2GqsJ67xE/i znS+8onbGuQ73SptdpdiJdbvF7pwL8f2jmaHTACQjmkYuEI9L1xlaL+bHO9hHwAQNGMIlJ wRgqa1qekxgztw+JhdtHB8YyNlIUu0g= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=e6kjY4QB; spf=pass (imf22.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 79255615A6; Tue, 13 Aug 2024 08:42:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4173C4AF0B; Tue, 13 Aug 2024 08:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723538541; bh=7RDgs8VMI/6+eF2Z36b9xbjlJF/pcQYAzN7TZVLEquw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e6kjY4QBWwfbNWiHe8VElP9KCnrcfr8ExLDYLTSGXAyZUKoHjuxSHsysbcFQW3sNz uJOJTUslbpGJu3jmOoWVmgIAI7VIY/0WRpaO/7Imdj3ZxKk0jNedzIdBKEcvY83QS9 YY9frlOlRS6WTCJCdPM6OB/PEnbl13D0XWfGM1Y8xZvUWK03GC3pmj/TKRyuK1gziy 8l38bTjL3SNjTgdTJmSzABhQZadMZ5IlqQy5ybd4c4HkOqJ7kNnzf/l71n8EdBaMeO 3HPTf+qZgh21Pf9MA4I3Qsixy8tr89Dq0GHnmIOqIZ049Ah98ulIdocJHoRVakaR8i p9USBCGEmOmCQ== 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 19/21] mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc() Date: Tue, 13 Aug 2024 16:46:05 +0800 Message-ID: <20240813084611.4122571-20-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-Stat-Signature: 6ikeibdbtkzpp3efuh4uq7mohek43b4b X-Rspamd-Queue-Id: 42FC2C0013 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1723538542-876044 X-HE-Meta: U2FsdGVkX1+6LfBUb++dlSmJIcxVyjs6DVbmICd3DkPzlnRD1xpJ4eE/5BSP7KXeJ3TlVEfi2HPj2oi0ny3DLgMU2MAgmpwzbsh785n1+i5IsHzTaTWhBnl41wEpr3py3zdHz7nD7t/R8p4anv3LrkZB4el/KUvUZhvxNgojDSbbsS/qK6LkTWRK03AYtHrRviYyZW9l7NEaI/piC8cvkcY+WK59uBxInlWgPeDT/l1svQxgPjoA6ardq2NTfs5z983wacp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RFev/pPX6xc= 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 Add helper __zpdesc_clear_zsmalloc() for __ClearPageZsmalloc(), __zpdesc_set_zsmalloc() for __SetPageZsmalloc(), and use them in callers. Signed-off-by: Alex Shi --- mm/zpdesc.h | 10 ++++++++++ mm/zsmalloc.c | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mm/zpdesc.h b/mm/zpdesc.h index 747a2d410a35..33f599081281 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -120,6 +120,16 @@ static inline void __zpdesc_clear_movable(struct zpdesc *zpdesc) __ClearPageMovable(zpdesc_page(zpdesc)); } +static inline void __zpdesc_set_zsmalloc(struct zpdesc *zpdesc) +{ + __SetPageZsmalloc(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 64b9ea011111..6e7cd5acf5e5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -845,7 +845,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) @@ -1018,13 +1018,13 @@ 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); return NULL; } - __SetPageZsmalloc(zpdesc_page(zpdesc)); + __zpdesc_set_zsmalloc(zpdesc); zpdesc_inc_zone_page_state(zpdesc); zpdescs[i] = zpdesc; @@ -1814,7 +1814,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, VM_BUG_ON_PAGE(!zpdesc_is_isolated(zpdesc), zpdesc_page(zpdesc)); /* We're committed, tell the world that this is a Zsmalloc page. */ - __SetPageZsmalloc(zpdesc_page(newzpdesc)); + __zpdesc_set_zsmalloc(newzpdesc); /* The page is locked, so this pointer must remain valid */ zspage = get_zspage(zpdesc);