From patchwork Fri Jun 28 03:11:30 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: 13715401 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 67110C2BD09 for ; Fri, 28 Jun 2024 03:07:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E35CD6B00B3; Thu, 27 Jun 2024 23:07:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE1786B00B4; Thu, 27 Jun 2024 23:07:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5A896B00B5; Thu, 27 Jun 2024 23:07:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A06F46B00B3 for ; Thu, 27 Jun 2024 23:07:47 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5C9F2801F7 for ; Fri, 28 Jun 2024 03:07:47 +0000 (UTC) X-FDA: 82278812574.21.518835B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id B2F7C80002 for ; Fri, 28 Jun 2024 03:07:45 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="ZZ/oDvEH"; spf=pass (imf30.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=1719544042; 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=B+/Hb8/S5Lk7yyk8AjSko509zSVfs0oko6ujW15zpCQ=; b=CqKIBPkyOaBC238g88UPf6azsJNljg7ytL30DZM9yT5Yu03XU/YfCZ2h8B0fZPI+H4WNuW YW5s3HloYKj1rZbprfK7ocS24zjuIR6PlthjFwMik1KAfH9twIH1f1mRix2T2xHZphm2AU fqm++HZ1a29KAO6mcbB12tB+xqwaHtU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="ZZ/oDvEH"; spf=pass (imf30.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719544042; a=rsa-sha256; cv=none; b=VXe/wFGsNJWmST9yN/3nHoFczrJe+KEDPsL4FYhYl8JrXWxoeeaIKK5mz1BIh3rF7/DovA 3YRDcz4wqUmCzQP2W/j8PgScFIMgZR3BPN3re1AGu37hgoPSsjaEy2F+7g2YkzGXIfCsrK MO6rJEQVvjQHvVHRVF3LgBbRhDFVfE4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DC35061DDD; Fri, 28 Jun 2024 03:07:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84569C116B1; Fri, 28 Jun 2024 03:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544064; bh=vusdBHzfqHkaDK8baoOjr47f4AAjSRZFJhrtyFn5Ac8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZ/oDvEHhBu8s6dToln3pesB6GaFXokhxzB7lNQwP7xSG6j/NBhslRWc1e3jMBzEO kiPYgyN2CWYo+tKF0U246DL7nSEXR4GnlsXz+SrRPmAc2lbptCrK5YiJF2xKiZdbnZ hv+O/C6NuSsMex3Y3mffzQo0IqaUOvYQc3E9iDlogODu7Y6/LHWRVBJwFSQnHwjGE7 GPzFRFyB0QXF9PAMKQW1jWAmIuF5gguivX0DnSVuME3aIdikODNiyyUvaqE/uv4A/9 PxxgTIaZaU8gQeEhxtl35LiMSPjI6rNW8ra32YGAVam6NcgKExAEY3Xxq9dui01BGi 68jFL4HIjdE6g== 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 15/20] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Fri, 28 Jun 2024 11:11:30 +0800 Message-ID: <20240628031138.429622-16-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: rspam06 X-Rspamd-Queue-Id: B2F7C80002 X-Stat-Signature: n8yz93rytiufabz5gx89h333jryc5f43 X-Rspam-User: X-HE-Tag: 1719544065-273848 X-HE-Meta: U2FsdGVkX1818d8QZF0BT5Gw//79a9L0Dln3e3srcspALorTSVdstI0OtjZMKX4whr8Sy4YaUPpibnf7BvHYveKxODCt+tOGdx7souz4K2GMLQch7dbNsZgIz3epJpbMwJicepT2TVXznLoJCusfDpvbLJ9VZIJaptiUI+It8o116waUwAnf9gg+waQgaeqEw7iG9NaAms0SR2SokbJJ0fqRdQw0NrW0ayhyHaz9tv/3dGJ6zCaTB7I8CqmWE5JIGapy5/yMYuuaGUNy0dK+/muJFO5HsJvAC3w7bpO4gfmc33nHVvFS2/Uo94prr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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 a10af49d8d08..c136124adb10 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -781,9 +781,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; @@ -791,7 +791,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; @@ -801,7 +801,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; @@ -851,7 +851,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)); @@ -1267,7 +1267,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 @@ -1317,7 +1317,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); @@ -1483,7 +1483,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); @@ -1517,7 +1517,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); @@ -1851,7 +1851,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; /*