From patchwork Tue Aug 6 02:22:55 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: 13754326 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 65967C3DA4A for ; Tue, 6 Aug 2024 02:18:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BEC66B00A6; Mon, 5 Aug 2024 22:18:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 707B16B00A9; Mon, 5 Aug 2024 22:18:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BF156B00A7; Mon, 5 Aug 2024 22:18:31 -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 228636B00A6 for ; Mon, 5 Aug 2024 22:18:31 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 923F440512 for ; Tue, 6 Aug 2024 02:18:30 +0000 (UTC) X-FDA: 82420211580.10.879E037 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf22.hostedemail.com (Postfix) with ESMTP id 98CB4C0014 for ; Tue, 6 Aug 2024 02:18:28 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HsMWYRZJ; spf=pass (imf22.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=1722910647; 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=IavPEFbNVTr4w9OfQ24+1A+3hl7N9lwrjw5Ixde814s=; b=QQZRZ65ftybBTcReTJG7EHXkf8tAHMiwoPsa+vp6znMNWGunh8D9Fp6dBN3jgFxeXnsRRd 3oXPAa237dJxlhESXjcRh4Rws2ooG8saJ1/9CO39yCT7ugHEqtmXYzR8K0tPB6wxH+uCkA /O1OSa3H+ARyQn+625Qb9WKo6KoGel8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722910647; a=rsa-sha256; cv=none; b=izwsjyIxkL3sSyH4l51+8xjQ3ygV4ZWl7Jl4KXFpBo+LfSDHkwA0m/DKJA9h4sD3SoijpH 7+3sVqDRDSU0Uudxe8VDM5IGW5S0JcOwZXWAiLVl3FI/Bz6FctaaQ6dQ5VEAkX/dCZmDng bal9mSgZ3QwBzRjd0FGQ6qLsfDk8snI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HsMWYRZJ; spf=pass (imf22.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 71A3ACE09AF; Tue, 6 Aug 2024 02:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9359EC32782; Tue, 6 Aug 2024 02:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910704; bh=vNwIGyy8uUag3zQP5bXF/PNe/niCN1bQWoZ3dk5XDpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsMWYRZJUqU0Itrt3J8567cHgcx7ZWcgbPSnbOQZy70q7mwkndUTL+/3BqxOm3jLe 1JRXz3aiwZLokB5iJOIAxSzflNxhwrdBNUmQ0yr+fTHmP6UHPnfZXf7ixPXMndCYtR Xvx0NYmeEH8VFJaWIPEcpkE44VAf3Iq0589/x9KYqXkzoR1v4hFCn9gXAp43FRTRuB 3gwiRk+9fT3CtV1V1KDMvvYsPFFrtc+3sl1sU18WkpAkEgFNlSYItJMcheDweCDUcj x6cS/1tCwsSUmImOLOvc1iIP45X2TJ1nhJOZhMkYGSHW81OmWHotixv+CqQ+uO3/q4 WUgiwGNqY5X+w== 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 08/21] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Tue, 6 Aug 2024 10:22:55 +0800 Message-ID: <20240806022311.3924442-9-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 98CB4C0014 X-Stat-Signature: 19gwm3si68zj5en4ezogz68jcoikzeo8 X-HE-Tag: 1722910708-667819 X-HE-Meta: U2FsdGVkX1/iFVOFMPd2mP0LVsr/+21mxA6kYihHKalT2ukPgDUDfXk/DsYPbGSG4twse/ftfitsplSrC8uMOd9T4zfT7WrwDyqjNVcMZoDtKf+2lQbY91098R5jbIkcfmddb5ad3vYLR3aY/sE9hPKO60d/Jeu1NhweQxDUo0qX2v1S+bFuCJ3iaEnwuN8QDx03Qs9cLp6/KHn8OHjMZYKMOEu55eJY+ED9L42W8j5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Mms2lSOQkMVe3/msLY8ADRKCW2EDicvWcIY05wv6J2Bk9LyO+Cp6SuWKt60z4vrd3w78 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 3c1755227706..d7400acd0f01 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -928,16 +928,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) { @@ -950,8 +950,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 { /* @@ -961,7 +961,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; }