From patchwork Mon Sep 2 07:21:19 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: 13786832 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 24F1CCA0ED3 for ; Mon, 2 Sep 2024 07:17:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 853A38D008B; Mon, 2 Sep 2024 03:17:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8067F8D002D; Mon, 2 Sep 2024 03:17:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67E9C8D008B; Mon, 2 Sep 2024 03:17:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 40A3C8D002D for ; Mon, 2 Sep 2024 03:17:03 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EBA86AB0AD for ; Mon, 2 Sep 2024 07:17:02 +0000 (UTC) X-FDA: 82518941484.05.761399F Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf19.hostedemail.com (Postfix) with ESMTP id 694E71A000D for ; Mon, 2 Sep 2024 07:17:01 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Tjz9s9qe; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261345; a=rsa-sha256; cv=none; b=b8ZnVKxE8kaEKDEDCDrl+sKb9PPtcvAc7ik9J7W1eU/1jT6TQbthgsCVfxCCBVVxJ9AQz+ Uu1Y6zgTXpmI/znRdF8TODnHLBlRq4OWkDqV568ITpryqV8j0MOwMjJ5UgcPincQKkwZWG 40C6SZ44+FrXL1fmeJvRo3CcgqRDtk4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Tjz9s9qe; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 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=1725261345; 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=x4TXNLnMsdl0fNmTeNSaIynFkauZj0U2N4u9NyBei54=; b=lg7AHZHXF+ToBnXiqVNxsQOnmdomi14a6ziALo8KQb2f8bLBUpmdLk5hAsfurkiybvLOiR i72CnoCAfcA/QURGYCi6w48NXzLEt7oXlDe+YAwPZnpZYgi6g3zFBZQHgE3B8x6bt5PzD8 LZ74ySvrzRLgS36FNdNVwASjXkJ/ZvE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B0DC9A4171F; Mon, 2 Sep 2024 07:16:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3069C4CEC9; Mon, 2 Sep 2024 07:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261420; bh=PNe+PCWyOI4z40ocTHR27DhffZO/+69yc298dwmlSes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tjz9s9qeCkxm3K4mcUE5debLCDqO25YRhRFWJ/avcEDhpY4b8AFlwwm6cq1qeRVSM TGzZdBTjO0kyKpbF/Z7DIxsvEizBwlGCw9sJadLQCvWyAzoTTek19qzxsiyEkUhEak u0KMdnQ6O+BTfJOhcIz2D04qnh0DCeQ4IOyceUrOokKwmSLO7zYm58lT2aGv38l27n ISkuZaS3xI44QuXK7+MXr0ymkpKO43OncUVwMQJoGL/cZpb3Er7s5xJojvxNtbKHEN vMl9o5p/VP+DNo/4sqQvC5TySyWuu0k5MImEY96NjGNU+enX0pdUQJ91RPuVGMeLfg dviBzU7NaaG7w== 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 v7 08/21] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Mon, 2 Sep 2024 15:21:19 +0800 Message-ID: <20240902072136.578720-9-alexs@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240902072136.578720-1-alexs@kernel.org> References: <20240902072136.578720-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 694E71A000D X-Stat-Signature: 1qkm65p9wwxzi8xy6xta1qarutwjqk3z X-Rspam-User: X-HE-Tag: 1725261421-529507 X-HE-Meta: U2FsdGVkX1+R90Fb7MHUCZyqt80WDdZlDayODUyIwSUkBl5Kz1X5whMgYkd9nNPf4LIqB5N2ARbE9oYdsuvj08wZ/WHwgKay5GrsIjgt0pSmCE8iZnn+UuAmPbjkKcyzDb5u9+KuHsFyzaqGPxto6Nz0Ir2GDnJ887KaONufEEyyb8JRy+OhCMez62xF1mPDqNLGKiRS3eKheuhGB8Se5x0EQN+ZUxVb9jeO9gTSrbDaiw/dHQvzZdKQEOw45GdxPTto7IFv21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U9Xx8BRNNjC2nChA== 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 46d8be5cb4b7..01c5be6f4c96 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -935,16 +935,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) { @@ -957,8 +957,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 { /* @@ -968,7 +968,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; }