From patchwork Mon Jul 29 11:25:27 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: 13744738 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 44DF3C3DA4A for ; Mon, 29 Jul 2024 11:21:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 040C86B00AE; Mon, 29 Jul 2024 07:21:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F340D6B00AF; Mon, 29 Jul 2024 07:21:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D855C6B00B0; Mon, 29 Jul 2024 07:21:09 -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 B9EB26B00AE for ; Mon, 29 Jul 2024 07:21:09 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 71B4A1402B8 for ; Mon, 29 Jul 2024 11:21:09 +0000 (UTC) X-FDA: 82392548658.03.23382B9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id BF3E1180010 for ; Mon, 29 Jul 2024 11:21:07 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NUq3ixaQ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1722252064; a=rsa-sha256; cv=none; b=Vmf8mhBms7nR4sWNxwXTcPazKrDzqqxZ4Od9Dy3MWqesnEN0CItMfvTJTPr2mvHL6/73iP Ug3vt2yCngYncFUVxfqYCdkRwYSqcYafBtRP+i7+FG1wgsUAslTWKD6wRZtmQ+Cpk+CHQt /M4BUf3o15J6scW2c1T32fP/4rNRjgg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NUq3ixaQ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1722252064; 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=Q9lrHJyVnJJavlQtfTrhM6Cg7QJsRwBhFfAPgSitRB8=; b=R9j2+2U29/4zKVWI8VXz8X1l8b7+m+brwztjwKcgPtj2d0JsQ23W9Zxpojr1hyYYrmeHH7 tkwfbjJ7RwK+BnHZ2UeuIkLjTFWZcLNwa+eUN8ciLK2OJWRoCW++GK9YUxgtyQoK9j7Dwj eKA/jehJk+sJdlkP4BvnhqDMXrbJD8M= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F177B6177D; Mon, 29 Jul 2024 11:21:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE97DC32786; Mon, 29 Jul 2024 11:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252066; bh=0AvWtekA1fBYWEoFvuJjRv8WAqdxESdkBRdAezOabRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NUq3ixaQ6u5c4OlwYwdVAJz07eKqVSBQDfBqsWK7nIM0s3VhqwQM/W5WH+38OmX5Q NdDZZABPrBrX/v4zQp5TFRvQHj1pd9c6rvOsn9KYIALCUJ57wdxf4CZQLZQzP23tEk uWbK0FAj5zbEjBN/yhkX4BM13sZH5rmKIGH1X6Zo/yGti7w4jcxTITcf5U6AC04r+i 7J1jFuwdbJdJ3f/JJlBlQ5q7HgEhUuAMtDiij8FsSs48lAraDh/Y92I/uVRmZgL62L wa3A9LbcmwL5fg6tBqdWjMkMRqO662420Fdy4oeamfSZBwv5R2p73tbcBwAqB351ox /xeYlJgosEmEA== 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 15/22] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Mon, 29 Jul 2024 19:25:27 +0800 Message-ID: <20240729112534.3416707-16-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-Rspam-User: X-Rspamd-Queue-Id: BF3E1180010 X-Rspamd-Server: rspam01 X-Stat-Signature: cmxr7ej6mo7pjqruqku4zgamogki3d9x X-HE-Tag: 1722252067-312448 X-HE-Meta: U2FsdGVkX18AblUaEotu07pGDe86MrxYD/9/fYVP6YF0iGYddj5eDThLcUJvkIl1+INPen5vvQ6gFcMEk7FxWBFrf2FY+EyWWRkgGMgacZ+0XJlaSLRtgIA/OCfC0hsydIU9LmvnXKzirYim7VecXS9m4R2twJJ/sjxvZaJ9Jo8HHMO2+OTqf+kG/qZeiAKtiOG52RAyYhiAkctmfrsB3Q4qhvIWaaUueRW3GxP4tGbHeq1jxt6QzO1Nw6Lf13nD23Rc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JxBrF2kqRv82k2+pUjwhsGVl7RJ+jfWVr 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: Hyeonggon Yoo <42.hyeyoo@gmail.com> Now that all users except get_next_page() (which will be removed in later patch) use zpdesc, convert get_zspage() to take zpdesc instead of page. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 7d039b0c66db..458ad696b473 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -779,9 +779,9 @@ static int fix_fullness_group(struct size_class *class, struct zspage *zspage) return newfg; } -static struct zspage *get_zspage(struct page *page) +static struct zspage *get_zspage(struct zpdesc *zpdesc) { - struct zspage *zspage = (struct zspage *)page_private(page); + struct zspage *zspage = zpdesc->zspage; BUG_ON(zspage->magic != ZSPAGE_MAGIC); return zspage; @@ -789,7 +789,7 @@ static struct zspage *get_zspage(struct page *page) static struct page *get_next_page(struct page *page) { - struct zspage *zspage = get_zspage(page); + struct zspage *zspage = get_zspage(page_zpdesc(page)); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -799,7 +799,7 @@ static struct page *get_next_page(struct page *page) static struct zpdesc *get_next_zpdesc(struct zpdesc *zpdesc) { - struct zspage *zspage = get_zspage(zpdesc_page(zpdesc)); + struct zspage *zspage = get_zspage(zpdesc); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -849,7 +849,7 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj, unsigned long *phandle) { unsigned long handle; - struct zspage *zspage = get_zspage(zpdesc_page(zpdesc)); + struct zspage *zspage = get_zspage(zpdesc); if (unlikely(ZsHugePage(zspage))) { VM_BUG_ON_PAGE(!is_first_zpdesc(zpdesc), zpdesc_page(zpdesc)); @@ -1265,7 +1265,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); obj_to_location(obj, &zpdesc, &obj_idx); - zspage = get_zspage(zpdesc_page(zpdesc)); + zspage = get_zspage(zpdesc); /* * migration cannot move any zpages in this zspage. Here, class->lock @@ -1315,7 +1315,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) obj = handle_to_obj(handle); obj_to_location(obj, &zpdesc, &obj_idx); - zspage = get_zspage(zpdesc_page(zpdesc)); + zspage = get_zspage(zpdesc); class = zspage_class(pool, zspage); off = offset_in_page(class->size * obj_idx); @@ -1479,7 +1479,7 @@ static void obj_free(int class_size, unsigned long obj) obj_to_location(obj, &f_zpdesc, &f_objidx); f_offset = offset_in_page(class_size * f_objidx); - zspage = get_zspage(zpdesc_page(f_zpdesc)); + zspage = get_zspage(f_zpdesc); vaddr = zpdesc_kmap_atomic(f_zpdesc); link = (struct link_free *)(vaddr + f_offset); @@ -1513,7 +1513,7 @@ void zs_free(struct zs_pool *pool, unsigned long handle) read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); obj_to_zpdesc(obj, &f_zpdesc); - zspage = get_zspage(zpdesc_page(f_zpdesc)); + zspage = get_zspage(f_zpdesc); class = zspage_class(pool, zspage); spin_lock(&class->lock); read_unlock(&pool->migrate_lock); @@ -1846,7 +1846,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, __SetPageZsmalloc(zpdesc_page(newzpdesc)); /* The page is locked, so this pointer must remain valid */ - zspage = get_zspage(zpdesc_page(zpdesc)); + zspage = get_zspage(zpdesc); pool = zspage->pool; /*