From patchwork Mon Jul 29 11:25:20 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: 13744731 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 C030AC3DA4A for ; Mon, 29 Jul 2024 11:20:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 486536B00A0; Mon, 29 Jul 2024 07:20:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E7E06B00A1; Mon, 29 Jul 2024 07:20:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D1046B00A3; Mon, 29 Jul 2024 07:20:50 -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 01E096B00A0 for ; Mon, 29 Jul 2024 07:20:49 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7A90DA35A1 for ; Mon, 29 Jul 2024 11:20:49 +0000 (UTC) X-FDA: 82392547818.09.B478F13 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf25.hostedemail.com (Postfix) with ESMTP id 7718EA0016 for ; Mon, 29 Jul 2024 11:20:47 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RxZcivsx; spf=pass (imf25.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1722251994; 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=7aSS3PfeGPzIHYEgpKcCy3AJpke6a4GKIbhcdDELY+E=; b=IYQTGbRQTl01dLR+BJ2MzRYMFS2/IgcX/tfNcfsIxByANC45ciYaqUTBPXgnh/yDjaHZfr GMVnUeaFazeem7I2cSEEayrDUeCHfBuAEMejsNBWZ46p47OP3mGr9AJQxQI79nAf7My7ox TwKM2JR++JV1tuA/V0spXU1oWhCMXdE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722251994; a=rsa-sha256; cv=none; b=bH+pRhub7HI8t7biZPrQTwcC/XuKr6+sq8GJ8ZHT0mT0tqFtwR4hF5QBav4Njjv5GMW+y4 xhg5HPI3pbylbbjJaZURMzHfV4hfunbMKUTMrg698W5j67/hA6HuFVgLd25Vmv40Xke1Qu tjOPd11Gg91XZOAYHlQXv8AjXI9Ursk= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RxZcivsx; spf=pass (imf25.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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 sin.source.kernel.org (Postfix) with ESMTP id 40EBFCE0ADE; Mon, 29 Jul 2024 11:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 232D0C4AF0A; Mon, 29 Jul 2024 11:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252043; bh=hCA+Wp2koQFPErK04B2puEI5lWDR1Rh4V60AMISo3bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RxZcivsxHrV7ru1KjcEzOlOvSeKDf/VpS35R1Jm/ckHCF5FkBHfPZZlKMLo1HZlJZ e+mZIYJdkYGOoowl74xkpbxMv+5NuCg1KbSFCL4kZ00Tqa3dTGnIiwH50thl+3pYVa Geh9a7OSmgGpOqv0ZOW2hZIUlBaMFwvD0xV8t4bdMzCjwlGp7rgp+nn3EGq3oahway 16a0c1+b0SjHzRW7oSgs1/gNsL+p0Ht9S6hgw8Abb/W7bj3eI4av9N4IaeoQx0Ogp7 ZP2Xcf2MLAk4ozA193cBosfrjL0qJE8Q7nrWXzuslYTjAjYJOrSlnhZ9DJHaPEbYhC GG/xWcMb4MZ4Q== 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 v4 08/22] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Mon, 29 Jul 2024 19:25:20 +0800 Message-ID: <20240729112534.3416707-9-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240729112534.3416707-1-alexs@kernel.org> References: <20240729112534.3416707-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 1tmu8kzp6djqmoqyrudou88yqqhub1n8 X-Rspamd-Queue-Id: 7718EA0016 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1722252047-165758 X-HE-Meta: U2FsdGVkX1+k0rAz/XyUkcM8d43Jmq7eEL6SpFbqES7OLElWdW4B+hS0ZiTizvQ7PiARkkcLLeoiVReIVMZSajpfQhCXPO0K6O+Z1Rl3lAk7lgGpts1x5Vr7faXe+UVTG+6YBquYE3r/IyntaT+KNXGwixQuv7ml/pG4/lb03d0uD/IrL0W6ZxWjiEkXuxNqE7H8nmOmS+deu+R8vApQSyOyz6vMwMONqaOPOshgPZMYPWHF9got7fFVpgQBA77gWA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KLFIHMU60bZTeZ+vQPjuibtPJXNZSAmVA== 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 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; }