From patchwork Fri Jun 28 03:11:35 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: 13715406 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 F22D7C30653 for ; Fri, 28 Jun 2024 03:08:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 027E86B00BB; Thu, 27 Jun 2024 23:08:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ECAB86B00BC; Thu, 27 Jun 2024 23:08:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1F6C6B00BD; Thu, 27 Jun 2024 23:08:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A78C16B00BB for ; Thu, 27 Jun 2024 23:08:05 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5C395141388 for ; Fri, 28 Jun 2024 03:08:05 +0000 (UTC) X-FDA: 82278813330.06.972D847 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id BAB7D40010 for ; Fri, 28 Jun 2024 03:08:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cbU3x2Dd; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.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=1719544069; a=rsa-sha256; cv=none; b=FvqlGlb/zB5Hlwy8V0+mltq6DTy9XPWioQxdnjGD1ssB+GihN9UzbQSuc/G3BkS06jcdaQ HZd4F2SxfaPZwdPz0yInEEgSppPMAFq53MGTV/UEtShupogthU+kinrJWTRxRseZN96Rn2 tgS+2rQhEpBAL3xyDFDkYr06SX/M6ak= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cbU3x2Dd; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.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=1719544069; 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=kWcP3+EG93bRygnAaI9FVjOhd9/5VSHv8cgJ50j0qu0=; b=RGlvnxhrp47nIxtfWSklUlM58Ipw0hmf6IQmatd5rLYdzCaKi1j9hU55W10jhLXmV2PkWg pfK4GZ3NHCvwwN633nvZGmHTBJY31+2rqFWK6s+Xl6xaui8NdLC8h1bCevc5xHQjyJTPFd gzxXqfLnmZ3ltrOYlJiwT9pgVVpcCGo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F1EC061DDD; Fri, 28 Jun 2024 03:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97FBBC32789; Fri, 28 Jun 2024 03:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544082; bh=4MKTXWqqoUrRELMNSTMj+qMl+m60BitHu1nDeXKuUgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbU3x2Ddh8UT1d2qoVfthnhMM+GJKywAez5C89nw56pBJLHMwtkvKj/JzIwEwMFRk wzmpdRUrNHYRvjA6DyL9hLgF2gtdCELLqOT0Ac2uw6PTQ1z+HCS0CPop6sQ5JrxKaL H6DNIP2g8MFFZxd1i8wYTSKZYOUXhQ+x0WRhjXVCeosCcHVhUCN33Xlf7v6uT8OUDw i/46Pz0IAIjX67naNUMaB2vjL8T6s7Fh8s8wMLWP9XALYQ8N1EidkmLu2LRwvgLF0J yE2ElJWpvcfyCD92w/NKVFID3nhC2abtUH7BW1bSfu8OtUlsZUF724zhamgTRYry3Z 7pie/+HAHWdWg== 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 Cc: Alex Shi Subject: [PATCH 20/20] mm/zsmalloc: introduce __zpdesc_set_zsmalloc() Date: Fri, 28 Jun 2024 11:11:35 +0800 Message-ID: <20240628031138.429622-21-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240628031138.429622-1-alexs@kernel.org> References: <20240628031138.429622-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BAB7D40010 X-Stat-Signature: 6m7hsbijnk8jahpipj4759kdrfwbsjij X-Rspam-User: X-HE-Tag: 1719544083-245715 X-HE-Meta: U2FsdGVkX1/GHbO/zI5mzxMBy1VPCIGL3xJxjFIkRl72uDCZ3M3uJW5AG1AL+6rCsp7Z/FqliNk+ScMlgtF9qyCOfJxWwU0zkV1oAYsl0RDSbSx7oEdbpLGg9bycsezmTakpcRelMeJyb0siXXNsLyksSEQ7MyrOoC3DV/CIDZXLZ+J7Qsb3KGRMGZfdBa71oBcl2cNx7Yq7eAzF/9efM3VOWX/t7c86K2vR6innSYPZNxv8/BVoJhBCajatZdI13o0foc/68XuMe4ECmcjJf1StJNHbmyTYSuPzr6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, 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 e346b39aba59..ef36fc3de75d 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -107,6 +107,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 eaf8dad04f2c..e2a506f53957 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1032,7 +1032,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; @@ -1825,7 +1825,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);