From patchwork Mon Jul 8 06:33:29 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: 13726196 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 882C6C3271E for ; Mon, 8 Jul 2024 06:29:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E25D66B00A4; Mon, 8 Jul 2024 02:29:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD4F36B00A5; Mon, 8 Jul 2024 02:29:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C774A6B00A6; Mon, 8 Jul 2024 02:29:14 -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 A6FE86B00A4 for ; Mon, 8 Jul 2024 02:29:14 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3220A1610E8 for ; Mon, 8 Jul 2024 06:29:14 +0000 (UTC) X-FDA: 82315608228.12.382AA49 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 6F9B814000D for ; Mon, 8 Jul 2024 06:29:12 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Udx6ZKiI; spf=pass (imf23.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=1720420138; 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=wVyqKA+nApm/aW8DpcUSLYRZbT7zL/VqgGna7L1YR1I=; b=GBs7DrYzt20ylZwk4rf5qyePxBNispKomqZ2VYsjIoVO8p4Voh0K6fDQdYXtEVx61QMj/f I7PH1SsTWmnKiKWp9mHd2KE4PIF3DptZI7Thp41wqh0Lx3TwbU9K+OIF0zwUywUpzju55K PWjbN+y4zYjl+oj0zeggZ1mkKpgtiOY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Udx6ZKiI; spf=pass (imf23.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=1720420138; a=rsa-sha256; cv=none; b=LTWYF0zwkAOoSRz0LzUMA/snlcnSa1Ymlx1oHr4Mvr329NSEoWzgJIx6hC0yR00lKRtNQr y2F4ZR/J/oFwpkI3pGLXvneZRIfA+1I3yp5FdLwpv8w3juW1jE8L5sX3H1F3ZJKWFRVqBD 8GG2PA1R9ADoBtegxEXIz5kuu5k8LFA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A2F1860ACD; Mon, 8 Jul 2024 06:29:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61E6FC116B1; Mon, 8 Jul 2024 06:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720420151; bh=kTQuh9UlyfPp1whk32zz/TIJv5bm40Slp4CbPrYPxLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Udx6ZKiI6UdDrWncO84TIziVamqJ5fINWm6oO/wLz3/XChs2OG1+FQ3/2CXFk5bsB +xnt0gGqyIejEqOGH8mFMn3jHKC05UXg68HadyIlWmoZJevSRe1mMUblw0apD2CvLE VVDiiNoSjd3uqsz3OlEEfcUkLSZ9kpfZB1DNcQ5zm1oZJOptjMhdj7m84Q8I/TYLUA Uyghf4PZ+BvaS3mhbU6a5VGy9FfQEJAtExYAJoU6t+X34kjcmzv8Z3mYH4eXeu+65d Qot4m1jNXsFwaryY0Q6swUwKwKZdsvF0NOycLP9VHpe5l9TAuhtbK8/5ogoE++r8jW umZhKDt6S3Gog== 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 v3 08/20] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Mon, 8 Jul 2024 14:33:29 +0800 Message-ID: <20240708063344.1096626-9-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708063344.1096626-1-alexs@kernel.org> References: <20240708063344.1096626-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6F9B814000D X-Stat-Signature: wj13e3ddxkesm9hpgi17ribmgheo6ha1 X-HE-Tag: 1720420152-612989 X-HE-Meta: U2FsdGVkX18s+qajTgaOUpM0J7bB/t50zKFAWtXQ3roa/WW5eg+Rsv2qtoBn4I3Ng3f0nQXo+pweC4/IjdQKceeE8rINCMyNC8E+P1/b22Tm/wWhZTEjR4L48OAtp+miIpgyCt/7YS1SNK12D4nHqHkMNcshb2vCBRoWoopPz85IIDLnlk2eRjulgSWdyoGLBhPMIde7EO1cmbbUv9l4AIVpV0qsVha2OoREyuiYDUA7lAhFp6AYs9VrKc+H9Q8Wa9N62+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cgv3HL9488Ecc1iphW5Dskas7wYsm 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 (Tencent) --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 29b9fa5baa46..d3558f3f8bc3 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -948,16 +948,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) { @@ -970,8 +970,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 { /* @@ -981,7 +981,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; }