From patchwork Tue Aug 13 08:46:01 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: 13761564 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 29328C52D7B for ; Tue, 13 Aug 2024 08:42:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B36436B00B7; Tue, 13 Aug 2024 04:42:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC0896B00B8; Tue, 13 Aug 2024 04:42:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E9D26B00B9; Tue, 13 Aug 2024 04:42:11 -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 6C4986B00B7 for ; Tue, 13 Aug 2024 04:42:11 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2B1E61C30EB for ; Tue, 13 Aug 2024 08:42:11 +0000 (UTC) X-FDA: 82446580062.25.6063A7C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf08.hostedemail.com (Postfix) with ESMTP id E54F2160008 for ; Tue, 13 Aug 2024 08:42:08 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=D0tJ5d2Y; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723538472; a=rsa-sha256; cv=none; b=u6he7Ws13kVf+xNLjRGHfIzb8vziVG+9yTMzNwOolM9MHVHw4QaQ4J8ou7gz/PeZgaNq9g 545QukBlbilL37JdXEb+41Q99xFiE4xLMdg2flBjMuCI47UNizR3eOJaFNZvqe2oPinSOD FSwPPrnxMqZDw9d5s1w8IIFDokErkcE= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=D0tJ5d2Y; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1723538472; 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=x2bsOUDxDA0avGMNOI+ZqM1BCFVQ4Kz7WTFkvpU5/aI=; b=mXr7op/VPbbEbbd17u3f8mmedh73ZDbX11RrVEWnwe4DZHaOXp8AAwJmDMrr3pq7mjFVWK Did+zBw3mLzkw5pBa+2EfQCYax57Qbfm0LEZ0Jyy/X9oWY6b5pip3JWaB+PKUkak7hG9iZ tx8hHCmzQMMHXRWFyyjdzalwiuvLKvQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 488B3CE122F; Tue, 13 Aug 2024 08:42:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E40DCC4AF16; Tue, 13 Aug 2024 08:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723538525; bh=tL/aSxtJHYmt2JA8n2u9RLnt0i9TICyqYsVXNrqh3nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0tJ5d2Ykx0EcLRUEijuPnSiFdQLUU+KiE+TEkgtbafVTWnhrhpjOOGIrKgUD+c1P nWObHJs0C3iwN/7tMgmGpNy89peRAfNOizZEYiOy6KG0gDzXJFn7hm3uhifphw5MqJ HpLxzjmtjt1nX7g1JiLabCtATwm1VUdkHHigB9bxgc3mDSZU1X8Iiwhm3iJOp0U3Og TZQDncbP6fbBm1G+6g3EGSdeyhoHL166jXO92b579SmM0/4viqqMgA4EXFUSis7uEd LUaTOvfVj/9xJVb+GTjsTyke/3ZEeF3t2nH4qXnAK6+sVBkbQnTxhYSP8Vmjcu3O4I Dyl83gBdiNbSQ== 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 v6 15/21] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Tue, 13 Aug 2024 16:46:01 +0800 Message-ID: <20240813084611.4122571-16-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240813084611.4122571-1-alexs@kernel.org> References: <20240813084611.4122571-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E54F2160008 X-Stat-Signature: 4nyd37gadfnfu6bw6ntfys1stjqpf8h4 X-Rspam-User: X-HE-Tag: 1723538528-649552 X-HE-Meta: U2FsdGVkX191+YnB634MG4vVDID9i9in0PqngJNLwOX87rw/wAgLMnZ6F/GUeszQO0mQ5C2gRgZyM54oXqqg3SOCFftgbvnbINB234P6obCdFOSn4CPVvbd68NUBOrzzJPcSGcV9OLVJgSM7TRiJIhbHtJ8mmX2NHYSbkAOpW14n1OcQ3V+dUKAEKauE8oCutZeC741E+Mcq7lJI5hJQL7KfHELpNBUwwRlw4MyAXj2cpsIXN8UKfcjYv8HDCm3aYMOtSha/0DB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j0M0aqFuKRtqomTvjDoRsmi+w== 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 f93af6e10c3a..5e96ff2ee0d4 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -773,9 +773,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; @@ -783,7 +783,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; @@ -793,7 +793,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; @@ -843,7 +843,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)); @@ -1259,7 +1259,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 @@ -1309,7 +1309,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); @@ -1473,7 +1473,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); @@ -1507,7 +1507,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); @@ -1840,7 +1840,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; /*