From patchwork Tue Aug 6 02:23:02 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: 13754332 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 265A6C3DA4A for ; Tue, 6 Aug 2024 02:18:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3FE2E6B0085; Mon, 5 Aug 2024 22:18:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AC686B00B2; Mon, 5 Aug 2024 22:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24EA96B00B3; Mon, 5 Aug 2024 22:18:54 -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 062BA6B00B2 for ; Mon, 5 Aug 2024 22:18:54 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A56EE81D46 for ; Tue, 6 Aug 2024 02:18:53 +0000 (UTC) X-FDA: 82420212546.05.06A0001 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id E611980005 for ; Tue, 6 Aug 2024 02:18:51 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DWgzmYgv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.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=1722910686; a=rsa-sha256; cv=none; b=XoGkipiM5lL/TKYuazrzNAysruNoTTZRzlRJUj7pweAGMJwlVDxTYzp518IAYTKqXAk8bV UQyHKwaOKuZJkS18zRZ7NAC9O9Io0j96R2dMzixb+BsQxoj6iK11Y7919SSSy2NsNNpJbr ulw6h3DuUquU3oXC3d7yNKrIVZwnkaI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DWgzmYgv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.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=1722910686; 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=4qvJssN0OKf7J45cyAlp9jz3d5IvZkEnKH1088GlueI=; b=tCGGRO7mANzk2SYMwV+T8SSlgT95QeKZXj02NkxxjCoJQS0bfk5HVjZb71dwlOCJxeMWuD U8m/7SJtEsNjJpI5pzDkBPeYna8zDmdnEsj6tzdipEZzKbaEUnbwBGl1xH/Z+UYk5AranK cwHflSxZPs7FR6DQrojZr+kUSd3QRfI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 23A4560EC7; Tue, 6 Aug 2024 02:18:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7538C4AF0C; Tue, 6 Aug 2024 02:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910730; bh=ogZXEVMMW4vu3mmfL4ddTVfOtlodq8fb2Ek8tntegjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWgzmYgv43cIb1Yiwb7X3nxE/pvVIH2czvwhcvBxw+2XWnAWknGn5a5R2zBnvcHX2 AN2G5vS7GEbGmHtuuwf4IQ+El+/Yo9rRX+lAukVEUWkiDn5Bk0XTE61vlWrhSNXtsw h0RBltoj7fNzr7nTdqweZjWmT4+rVA5Ye+/YKu7LpAc6OM+i0DtFuwv/Xjziz4XPMJ yykfc6l+Byh1PYyMscKofhgssFWWTA1a90SfMRPHgJDCsBwDIKx9Y7d+Jtld/GETLC eaOgOHDsyvsotZXHSHWJd33trvlCMq2Ie47dpzUtR/Gs3xRP3Vg2pqkk72SXbUh0fa OCih3mDoloK4w== 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 v5 15/21] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Tue, 6 Aug 2024 10:23:02 +0800 Message-ID: <20240806022311.3924442-16-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806022311.3924442-1-alexs@kernel.org> References: <20240806022143.3924396-1-alexs@kernel.org> <20240806022311.3924442-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E611980005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mzbk35xjmxyirgd7yi8hckq35kejcrud X-HE-Tag: 1722910731-304529 X-HE-Meta: U2FsdGVkX19J1YhoqoYwIYz72hQRVWunFxQNtWQlsdsc4e+ZmZO3VMbGo+jSGrUTvPqGZIO7sX4hlCMF04J+/Lkcsa94kkvL7qoPYkJKlLtEfJFz2BWdhw1PmkkwINuyTPH2rg9bbID3GoDTD8jPNDjg47eZ/e990X8WBP2kxREBscLZIsjrIQLak/6tf+XwclzMqEvl3qypqwFPxBaqaZIws9wg9Sq86QP9oJ5KuQ/iYk3Gq5yElnka7dOH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NVPfE+q7UdEE3oZRzlwTgL0byvRR6z4RHGr2ch5l3kM7ZnqvQ 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 c8a533b516ea..7ae98d048590 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -759,9 +759,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; @@ -769,7 +769,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; @@ -779,7 +779,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; @@ -829,7 +829,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)); @@ -1245,7 +1245,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 @@ -1295,7 +1295,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); @@ -1459,7 +1459,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); @@ -1493,7 +1493,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); @@ -1826,7 +1826,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; /*