From patchwork Wed Jul 3 04:06:10 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: 13721229 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 58324C2BD09 for ; Wed, 3 Jul 2024 04:02:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD2DC6B00B5; Wed, 3 Jul 2024 00:02:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D59D36B00B6; Wed, 3 Jul 2024 00:02:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAE386B00B7; Wed, 3 Jul 2024 00:02:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8E9736B00B5 for ; Wed, 3 Jul 2024 00:02:31 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4568F806F3 for ; Wed, 3 Jul 2024 04:02:31 +0000 (UTC) X-FDA: 82297094502.25.03D360B Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf27.hostedemail.com (Postfix) with ESMTP id 3E7C34000A for ; Wed, 3 Jul 2024 04:02:28 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=S95km11Y; spf=pass (imf27.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1719979326; 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=UTf/HlUyEjbIfUKANcNriOGEF7uISZlhqNW1oQ4W2Ao=; b=YaP9LDo7tyoa+dVbImlu0uMRywQYmqCAa8N/MhblWceLniKLBkosn9D9QIWvS5FL0OTjhQ Z9DtyWwyV82OeTA8UKUfxak4vZyoEzd0i1eA1cZ0YkcTsu6vt9P2Wu1jf5TrCU5jsSzek3 Qm2LxUzJYY0ygA5oAgZZZFYXhw62g4o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719979326; a=rsa-sha256; cv=none; b=wBQuLQetnUT7a8vT24XrproIcOrhEdeHBwWgwuohHDHmIo5NBytzh5vRzNseAT6RJV5RjM Labu2OSxqorR1z3sODwRYhrJedMUc0xDauUnJ32+eJSeN2mMrQOhb0PuqhLKn4iEUal3Z3 TEzqgCv1/9PtMEUNzYVIky1iYFZfwd4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=S95km11Y; spf=pass (imf27.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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 sin.source.kernel.org (Postfix) with ESMTP id C21EBCE28A9; Wed, 3 Jul 2024 04:02:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A954FC32781; Wed, 3 Jul 2024 04:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979346; bh=xf3aTHyp0ikeJrBlj+XtoBw8uMm+YJ3YtskUpiov5H4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S95km11YpkihSJvZhp/uEBasmUDA3sdyzUblqTJ0PHexxmxxWnXUj5mtykzJHpNrL XD0RWT9AlXI5pqwVWqcqGazjfUItM50KJOKLYBKitIgobArYWP0maVhIJWPj3Yq0fS sybAhV09B9V1Q7sDjIyjXElsWNUCNqumEPPQgXAFRXYD4otlCHYNLmBIiEUCaOqA/k 2eWyrQRHBNjkRAGZQG7t7PJnxkokERgGGw3mKOEfwa19w9CEgKNLYpKeNNXg9xqttq 1XwiKETYPDACzuEAZsYk7Nw+G5Bg9RICoxyHVdnSsINHRH3Qe+11uFGhN0hZY5+La2 Xii7jQTm0oudA== 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 v2 20/20] mm/zsmalloc: introduce __zpdesc_set_zsmalloc() Date: Wed, 3 Jul 2024 12:06:10 +0800 Message-ID: <20240703040613.681396-21-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703040613.681396-1-alexs@kernel.org> References: <20240703040613.681396-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 1a4eshprx8597cqre7o4xzj6n8wr7b18 X-Rspamd-Queue-Id: 3E7C34000A X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719979348-206046 X-HE-Meta: U2FsdGVkX18al88XHmY6eCCjeuLN9rE+AU8rTC+FqW0VHN0QQv+pgG7AMpeYuWjZQaVd7vKJxfBeUOXaBOvigFhwC20bxRZGD1GWamksxN7xBxQnxYVX0OVBW/eNXf5UmrZ+3DSXYr3drfHUXqK+oUoJnkE151fpD06VfZF1UC90iPuIRX5UktVLbtY6DdKgfcwvgbqQZ78iaogJsDAMiwA8KFtw+C77+ymB58LNmgNcIMfUcCadRLSVbnXBisNwcikBnKpAcBFE4W8V949oaAoGpLPwJ3/8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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 e6a71c7a3254..d0e5929c1666 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -116,6 +116,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 9e87a17ed802..7bb85447de94 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);