From patchwork Fri Jun 28 03:11:23 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: 13715394 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 68F8CC30658 for ; Fri, 28 Jun 2024 03:07:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 001246B00A5; Thu, 27 Jun 2024 23:07:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC9336B00A6; Thu, 27 Jun 2024 23:07:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D45946B00A7; Thu, 27 Jun 2024 23:07:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AF99D6B00A5 for ; Thu, 27 Jun 2024 23:07:21 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7035D815BF for ; Fri, 28 Jun 2024 03:07:21 +0000 (UTC) X-FDA: 82278811482.07.C8831C6 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id D18C0160012 for ; Fri, 28 Jun 2024 03:07:19 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="T/NycspK"; spf=pass (imf08.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=1719544022; 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=JoluYYH1w0+LRC3DRts5ANJYAAKNLdDWIwmlIS8zh+0=; b=6Z6wcSziY0wRLpRTkXRhMHWGLDgA5J5tth/074mO3SMGt7k8pSI1xUxnnuGVArlrx9F8T3 L9p18VpdZGcbK9mGULdYoqigKBZRXnzR42wAbURGn3VXBUHQ8BqHXpd2yT7UgyczOaIdZ1 WoHUDHtMhwWPWUbWy+UJPjT1MWdk0dY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719544022; a=rsa-sha256; cv=none; b=FcoeESWhlJoofb8QhuCndxL/aLROFx7vVdpCpU03MjlqsJ7typHKZ7K9gfVSJHfjE+UMUn O7QRrhXkZE8nGELrjHNiRZYo2Wi5euJYJBxDH/1PE2e/sih8suDtMcqPuCt8IH7M8gkIZu rLr3HL58ZCl/9KHRKieEVCwH2qCLwv8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="T/NycspK"; spf=pass (imf08.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 039316204C; Fri, 28 Jun 2024 03:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BECADC116B1; Fri, 28 Jun 2024 03:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544038; bh=KxgG3cMNh41F6OEFoev4W8KoSH3YuCbiC9yyKNDszWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T/NycspKY6Agf3MdDX1SDFtv0XHJhE1/1Ar+c+DWV0XEmuLaiYftnIc+JENyd4fOp daPtvZ95Qs3DI6xb3UCA8xlF8P5PlQ/U/k4ab1NL2hTXfOZIGYOVgEu4+CUaGkdhD7 tnIc259NZ3i5cYSavDbG2dHMBBjGtPv+RDgT2nUnnw/BAADyjfgVLMBjIpzXz5UpxI XDHb0hrUPW3d/n2EGhhU1NGpmpuktWX3xvOYAhE08BtUB6xV847wDyefrPg9uwS2fC 4rwIcyKebgAB+DWqa/OMETiqGnf3sC98/n1MmdU220AjgU75XO+WRb8rdkVVaC1/UZ ZRaOiC+UnURdg== 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 08/20] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Fri, 28 Jun 2024 11:11:23 +0800 Message-ID: <20240628031138.429622-9-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D18C0160012 X-Stat-Signature: xbd6ogg7ehauio6sdpcbih19ng6ef3dh X-HE-Tag: 1719544039-129355 X-HE-Meta: U2FsdGVkX18LuqSbQJQHcN90Fxg0o7Phpt5hl5iwt10sdhgiEn7Uc5Atge1MKZ3klImdUClKClBh872TFOdS0w+NnVqHQUoShATRkjI/FqLnZeZWNfeXsdPzexuUP0Acgqawm6liiNC+yoFC38DOBNBVhyzzFxMg9gTv7Gt10pZIoIQOZm4vz75OSxy6dpfEqIP/CzCvdlxYLFEwp1Azs7Mo1GDBp37TgxQC0RGOGasidvcSxlDSuM3A0qt9UhIgKYv1Ni7TY9DwSQ0btOaYmXed8c4Tjkp8H5gDLGaqUKIWqt+uoV+A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BQ5Q== 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> Replace get_first/next_page func series and kmap_atomic to new helper, no functional change. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 6efaa6279687..e90e3a638068 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -950,16 +950,16 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) { unsigned int freeobj = 1; unsigned long off = 0; - struct page *page = get_first_page(zspage); + struct zpdesc *zpdesc = get_first_zpdesc(zspage); - while (page) { - struct page *next_page; + while (zpdesc) { + struct zpdesc *next_zpdesc; struct link_free *link; void *vaddr; - set_first_obj_offset(page, off); + set_first_obj_offset(zpdesc_page(zpdesc), off); - vaddr = kmap_atomic(page); + vaddr = zpdesc_kmap_atomic(zpdesc); link = (struct link_free *)vaddr + off / sizeof(*link); while ((off += class->size) < PAGE_SIZE) { @@ -972,8 +972,8 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) * page, which must point to the first object on the next * page (if present) */ - next_page = get_next_page(page); - if (next_page) { + next_zpdesc = get_next_zpdesc(zpdesc); + if (next_zpdesc) { link->next = freeobj++ << OBJ_TAG_BITS; } else { /* @@ -983,7 +983,7 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) link->next = -1UL << OBJ_TAG_BITS; } kunmap_atomic(vaddr); - page = next_page; + zpdesc = next_zpdesc; off %= PAGE_SIZE; }