From patchwork Mon Jul 8 06:33:41 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: 13726208 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 2E591C3271E for ; Mon, 8 Jul 2024 06:30:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC6276B00BB; Mon, 8 Jul 2024 02:29:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFC6F6B00BE; Mon, 8 Jul 2024 02:29:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD9956B00BD; Mon, 8 Jul 2024 02:29:58 -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 8F15E6B00BB for ; Mon, 8 Jul 2024 02:29:58 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4AA20C112C for ; Mon, 8 Jul 2024 06:29:58 +0000 (UTC) X-FDA: 82315610076.26.A14FAAA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 9A6C518000F for ; Mon, 8 Jul 2024 06:29:56 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P9pIQxRc; spf=pass (imf16.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=1720420168; 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=wsxt4rNTbw9Dagf/zy9fIyYFtO9bbv9nnBup6MaVTck=; b=rN2lraOsm2TNE17ubAzKR44fqNZ7G73FZKUAlHzL/c5bAViPd8ay6AOwVvdgY05F/RAxvF /s3Pt27Y5oIMxDm48PdmYy1VuJvlImJzl7wUGzRe6/9nz+2ZMB6ZBLfJdpQojQ+G9/FH3J NO4Y9rhDxfYqLkJLpTP9zRUuwRDOWPQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720420168; a=rsa-sha256; cv=none; b=Z0QzKK7PIB5ROd3wD1EmDZdrtc81RhnDlsgSt20jfZMEdRhk4m3CQUhFvh9LV6yr9nMOUt oQEqNWDaAqkjQNz7dNlKjmqlp50Oby3bkYm7p+5DauP8vWvqb9VU8vw6oI9WGB5A9rKmEn K3DcepfBJrMJ4ehC7hyhZgoE4lAAeZc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=P9pIQxRc; spf=pass (imf16.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 CB28360AC1; Mon, 8 Jul 2024 06:29:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89CF3C4AF0B; Mon, 8 Jul 2024 06:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720420195; bh=YePXlWlhu0t9cQ2FhNb4Tu9YraM33q9YNNO84M2/1AU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9pIQxRc74qXODLyeYpN9Usf+mKhKNyEtYaG/uShlHPiP4pI4bAMJ0ZxPksRq+auS Qq89KVFjK+cS/UBpysNLdcOw2E2hcw1sCMvZl3KUc+HOJbs49yZs8V9xBzD7CQpPXk xrf1GXo8qGKrN8Mfj5BxDOcq96OdiaGcpT+j9Z+Vx0xpJbuPHuGsusNl5njig/hpaW a2NyztZknNxisBfbFjaz0C56dqMEDimRCGr7nI1JjNqJV+zZNtkz4BQqyS4XDUDCt+ XUshBq06XfyGRAvEqCFVF5NOrrRoaTNdPTkLKW0edIVF8ssJm5jovq14e7nkoO7ZPB O0r04fevGt45g== 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 v3 20/20] mm/zsmalloc: introduce __zpdesc_set_zsmalloc() Date: Mon, 8 Jul 2024 14:33:41 +0800 Message-ID: <20240708063344.1096626-21-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708063344.1096626-1-alexs@kernel.org> References: <20240708063344.1096626-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9A6C518000F X-Stat-Signature: 8ohgdk1kbtcmbmwnx49u5sbff5nar5k8 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720420196-318136 X-HE-Meta: U2FsdGVkX1+pc+KThKtNv7KI8jeOtdMUrJ7tPPhV8eD5I3YjWruUFHbS0x5use2qIhsNila8CdcEEicelLhlP3oS25tGPCkggMzG0vq5S7aWwPEmiLLkUzdw4Ut1XtnU6lJzTrCsL0wfT8APNjc+HXT62Sm1XCh4aGOzekcd3ovGv2bc0bWAwuvRD82KDj+8l8tU1RKma5Jb2J+2jDnEntQ3BmEnNRct0dFBGgK8pZRYpSW3pqmLYV6DAk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XFvb9jeDMdDNtXDQ1EEStjq75dI 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 (Tencent) Add a helper __zpdesc_set_zsmalloc() for __SetPageZsmalloc(), and use it in callers to make code clear. Signed-off-by: Alex Shi (Tencent) --- 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);