From patchwork Tue Aug 13 08:45:54 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: 13761557 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 54BA0C52D7C for ; Tue, 13 Aug 2024 08:41:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5AFE6B00A8; Tue, 13 Aug 2024 04:41:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEBF06B00AA; Tue, 13 Aug 2024 04:41:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B826D6B00AB; Tue, 13 Aug 2024 04:41:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 966696B00A8 for ; Tue, 13 Aug 2024 04:41:40 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 48B1580695 for ; Tue, 13 Aug 2024 08:41:40 +0000 (UTC) X-FDA: 82446578760.11.0F3D5F2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id AA08F12002F for ; Tue, 13 Aug 2024 08:41:38 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=F7UIAcQ2; spf=pass (imf29.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=1723538443; 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=WwpC/yQMHyHuan9IsFC4y31Y+QMOJ0jRvo30Z33pQSE=; b=QXPNoBNnkWgxg7BHq1ljHPn13lnImgjC/NN1mKFwfwpnAgERp6sJHLIlyU4i9cgVnPfbKU Z/yNX2gH66nSXh9mom/DwT96IsX9mUqYhR8tHxw8a/4nnaAWFOxpNIQ7imBOfwXuDQb9/u lMmW3wmT5MX3fQ67lkUMUNmXU7n9+fU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=F7UIAcQ2; spf=pass (imf29.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=1723538443; a=rsa-sha256; cv=none; b=maUXT33EzF7N/eEEevROwbqPdoSgOb2pGNPU8mm4+yD0+3m8e7qJ/ZZwJneiqevvWbZbFb CGFytXVHXt+8F8BUX1dCqqcuOPYHUnuiIp/+Gp8MT9ELeMkTky8miXqZxPIFb3mq0Aj+Jg Ee9ubIN6aNSW/cwIscMgbi/QVMt1tOk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E1CD9615AA; Tue, 13 Aug 2024 08:41:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84F52C4AF13; Tue, 13 Aug 2024 08:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723538497; bh=WK8OGotBTrkxbKYhrb1ooiiEWg5GM27+9CUbteEDELE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7UIAcQ2ktZdGn1OWLy0E/zasMsvSF0kijBroHF8EHYacYxlB2MSlCDYeT7dZ5PEW hKROAwVNCVMZVR+fwI0yTGPNoBq5EBrBecd+M52TBLNgx+wkv56wwvC12zZhUQ8mwT +F+57D62/AqdkqlVTqT1n79ttTF99im4A3EcDPvAFtxW64q4kWkdhyQBTAd1UPNn6J Jsjm3wHPRJ86FBV0xo8SRnIYWL6ysi77/wGwMHyBkg0DBonGQ/oe4+WZG14R5xU9Md Pjw4a+uz84D61qulH54+gpXX+rMLGjKv/rwbp+re9WUDj8w72WRHBXQP9CHoAlNvBv ceaxbBtYv1Beg== 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 v6 08/21] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Tue, 13 Aug 2024 16:45:54 +0800 Message-ID: <20240813084611.4122571-9-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240813084611.4122571-1-alexs@kernel.org> References: <20240813084611.4122571-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: ufkcw87exjf4ao8rrntdzsw5dafwbpu3 X-Rspam-User: X-Rspamd-Queue-Id: AA08F12002F X-Rspamd-Server: rspam02 X-HE-Tag: 1723538498-132332 X-HE-Meta: U2FsdGVkX18odWHM1f7GySOgpp/6MxVdKMQdI2VB1RniVRbNQX3k5Jzfz+uHfK+fdrEwEHP0G1HTwyVRnhmwzXdLFm7pXwRAsR3LzVcyJVnJE7O2wa+EnN/lQN17YWmTJ5Cs0sdtA0SXrwzM/Jh4XeiyxlwhQqcHsafALjGoLosmwLUqKmEvAhzyIapeSZHegIlpr1sChZWx3qZ785/m4pgZGQ2su3BV3+bPNnihkuY2KFOmz6lN+oL7/f0i0b7F8u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9ZnZAPmCCyvbvnussSJ6q3lzrfQ0gnYxIpk7A/ 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 69305ddc0e81..b07c14552276 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -942,16 +942,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) { @@ -964,8 +964,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 { /* @@ -975,7 +975,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; }