From patchwork Mon Sep 2 07:21:26 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: 13786839 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 73562CA0ED3 for ; Mon, 2 Sep 2024 07:17:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08B558D0092; Mon, 2 Sep 2024 03:17:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03BE48D002D; Mon, 2 Sep 2024 03:17:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF9728D0092; Mon, 2 Sep 2024 03:17:27 -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 BE6C38D002D for ; Mon, 2 Sep 2024 03:17:27 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 80AC5161A32 for ; Mon, 2 Sep 2024 07:17:27 +0000 (UTC) X-FDA: 82518942534.28.783F352 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf16.hostedemail.com (Postfix) with ESMTP id F29F3180011 for ; Mon, 2 Sep 2024 07:17:25 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="GXjsatA/"; spf=pass (imf16.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725261423; 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=ggXGhnl3S4mO4sP+Bui+R+LSd2kVi+0mgL3AwPYgeTo=; b=bsD2JKLOb9NHuIvOiiad50eZziTdqm8ea4KjZl+yDGDhoQxjy1+gOxO5rzntnHqpOqOEWJ lu2llDApfFvFSv2ZXEfFMqttJLovncm1EIXohPvPhM7WvfnqJMxIPf8Upm7pt6MEZX0Wnc bltXE8RXycOgEqzR1dMO5xjXOUJW/VY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="GXjsatA/"; spf=pass (imf16.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261423; a=rsa-sha256; cv=none; b=SmNDEr1qKwXKoD0tCXRhzMcF8kgIGIcQJ2R/bxJLP47KOTswBSNPvjPej5i1AcbnWyIBUl +mT8B6wEFN+gsFUK4XBG5JXIkXF0QDFuk54NGzRBkPzdBL7PWrRfUDrwpk9ByoFIL52YBs /EWDKALDzqxo5VFFzNdlF4T+y7tpldE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 373D1A41712; Mon, 2 Sep 2024 07:17:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AC57C4CEC9; Mon, 2 Sep 2024 07:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261445; bh=5d5O3WmlEwe4HKiK+a7YzCdtF3HLgTzqKDcXKeTJtNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXjsatA/b+bhLB5tHwCAiwV9pwnZATA6bAxMquy1hdL0LTxEf+G8D8b14lHW4PpbA YCLIrtwj9QXxUugNM0EKIeD4C5K/78gOBane3bfpBjUBmWXw40jJbTHEZGGyShhWtE a+OLLpl14bHKuvWxt+6wkxNlOTZg0oeM/kzbgkP2bXfa5YfwkdT0bHCLWPzBBXBTYM bY9oCR7Z8pWjz7hOpbswP+6qh7eAVoHu9J7os3pkqWqR8j2vllzd0uD0RFTmr6iLW6 3TAImOXHbZFvxvvi0yyL8lHiQSwH7gMFC9Nx50eEFSXu2sFl51dpXJ+o5Ba5b5mgh4 PRgEY1VF82sGQ== 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 v7 15/21] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Mon, 2 Sep 2024 15:21:26 +0800 Message-ID: <20240902072136.578720-16-alexs@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240902072136.578720-1-alexs@kernel.org> References: <20240902072136.578720-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: qizh7pqfoybf8gmwxq1qi4iijsak4rfb X-Rspamd-Queue-Id: F29F3180011 X-Rspamd-Server: rspam11 X-HE-Tag: 1725261445-185308 X-HE-Meta: U2FsdGVkX19WE0eoVCXXKWZEx+7e9jzx8ArPkUXaOwaR0+GW+pbuufNSDb1mRN4Rf+L5Owjk895ZUDnBCrJzwD8BhKM+Ur+pKPJUoo0UYz8VuIRDUU5pbLTLcnDcdJwMj37aJ1VKCfbNdRAJ4rCU3uTluzpEpbee4K+FkfrBHYvAbg4woSEe9vNVIuO/wtDbRGe8Fq+aoNHlSjKOxB0SzJVMalrYTj1IbPIJXrufcrpvLwbk7eWeJyT+FlddlQ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m8oOyIx2dw5+uQOy38exMYyvIRUX5Chg8SFTGEDw== 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 aeb8cab5767b..d9251450ec60 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -767,9 +767,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; @@ -777,7 +777,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; @@ -787,7 +787,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; @@ -837,7 +837,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)); @@ -1252,7 +1252,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 @@ -1302,7 +1302,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); @@ -1466,7 +1466,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); @@ -1500,7 +1500,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); @@ -1833,7 +1833,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; /*