From patchwork Mon Jul 29 11:25:32 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: 13744742 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 838B6C3DA4A for ; Mon, 29 Jul 2024 11:21:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 040B36B00B6; Mon, 29 Jul 2024 07:21:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F32DD6B00B8; Mon, 29 Jul 2024 07:21:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5DE96B00B9; Mon, 29 Jul 2024 07:21:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B4C856B00B6 for ; Mon, 29 Jul 2024 07:21:25 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6DB7F802CF for ; Mon, 29 Jul 2024 11:21:25 +0000 (UTC) X-FDA: 82392549330.02.05FDA2A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id DBBD08001C for ; Mon, 29 Jul 2024 11:21:23 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="hUHlbM/T"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722252044; a=rsa-sha256; cv=none; b=iTc/lfN4lrZGdFz8+WmjFEBHP86nVm5Acl9qrkhCS5XGrTaPgDquD7WWG+tYbHmndyGq/z w/HwIKutZC6fXjRZ6WF4haQetNdv1SQ6wlzGwQHGj6xRA4DiMcIiY9EKaEQqINlGWykzsq 4jG1mOaSb6xbLO1HWjofx26eZXAvhKg= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="hUHlbM/T"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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=1722252044; 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=9AJyJQMNBE4AqPVQezkcYoW4glyqNYedmb7MWvUGoo4=; b=3Mv3D5bfJNp6H+ibGUIRDJ3aJWDCz8KxFeSVvyOPMAmsv7vuTVgPQeAxRQzWRtHXIiL99Z YyTnTd+y8kDLhA0ZoS90Qaa3FSXlL3I37Tbtg6EJ9ayqUq922eomRq29218VLC8X6CazNI kPR65u/W7BCEFN0yQvlU4lX3aIVhRRw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 26A8A617A6; Mon, 29 Jul 2024 11:21:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33FA2C32786; Mon, 29 Jul 2024 11:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252083; bh=U4TlC31Eh5dq6Szo/Iu40dA9+YSQztS7ohMuHhtrtaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUHlbM/T2v2RtXsHmp6QIE6F/mi7q6Je8OLzlD/lexCb2P1pX21JgHzDv/TbkSYP7 j/i58sijth6hxlaay3bpDMXYY1XTUB32nZXeDQI4c0iNeq3R8hqJif09oqqGFIHW03 ycgzafFlbbUM7z1E/+is1BED+Izlg3fW34+e+sdv7n+eawGF0JgSqqNp/X6hI06t5h 5wOzG3uFnpYyb7tHw6LyNAC3dMteobqFfLN1K5RoZB9LszFDuRCtlc7BElwgP1BgeK EliDMwNkMg93GXpaKvhxPKwZSgj8Go4CcBcdrVaY57+nI4Kzh5Ueooo/GqGxUhgsZ9 XljEaxsXtUaRA== 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 20/22] mm/zsmalloc: introduce __zpdesc_set_zsmalloc() Date: Mon, 29 Jul 2024 19:25:32 +0800 Message-ID: <20240729112534.3416707-21-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-Queue-Id: DBBD08001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: wodwrjja8b4qfhpsqmmktytjeyb4gdcq X-HE-Tag: 1722252083-179959 X-HE-Meta: U2FsdGVkX1/1ODiBseIb/dq/dYK/TgoqkoVvaBoHYeA4b6bMmqugf/71bL+GYEiNauC59xl88Du7ilnA4Gltrs19D6sF0CbpkmeSJ4Gz3h/AWACBkYCPUQrm9kJAs3nlNdVwFHFGHmOsy2wY9yXuNBB0bKDA2dJLe25dxWBH9ni4LDztBv9jfWrceb2y5AZpPuxZz6Yb/ON0tjxYwLAzrDWsZUDJPOZo/R6MC/eMVlAo9IfVZL7ZVr9XA9nDGO6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hvaz1zm9JvkDdMUMAcV9HB 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 a helper __zpdesc_set_zsmalloc() for __SetPageZsmalloc(), 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 05def4d45265..06371ce60cd1 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_set_zsmalloc(struct zpdesc *zpdesc) +{ + __SetPageZsmalloc(zpdesc_page(zpdesc)); +} + static inline void __zpdesc_clear_zsmalloc(struct zpdesc *zpdesc) { __ClearPageZsmalloc(zpdesc_page(zpdesc)); diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index d88602fb0233..7f8e02df4e3e 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1030,7 +1030,7 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, cache_free_zspage(pool, zspage); return NULL; } - __SetPageZsmalloc(zpdesc_page(zpdesc)); + __zpdesc_set_zsmalloc(zpdesc); zpdesc_inc_zone_page_state(zpdesc); zpdescs[i] = zpdesc; @@ -1820,7 +1820,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);