From patchwork Thu Dec 5 17:49:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13895890 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 1A308E77170 for ; Thu, 5 Dec 2024 17:50:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B60256B0170; Thu, 5 Dec 2024 12:50:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A5E266B0175; Thu, 5 Dec 2024 12:50:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 688FD6B0171; Thu, 5 Dec 2024 12:50:07 -0500 (EST) 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 3B6606B0170 for ; Thu, 5 Dec 2024 12:50:07 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 780611C8696 for ; Thu, 5 Dec 2024 17:50:06 +0000 (UTC) X-FDA: 82861643844.29.76877FC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id B75D716000A for ; Thu, 5 Dec 2024 17:49:53 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="fg2Wkhv/"; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733420997; a=rsa-sha256; cv=none; b=R4TvYRVV6r/6pxVRBw8ajBLdYJYy+NZqBTQBTN9F8T/3NzvayScaNOrU+Cq//iVAbqPJ8y NoO17ul5rMc76s3+cX2O2hyvHbBgaxpAp9Ykm8TQUjjsX+BfAYN7h9s41gLii5R7fyzcS5 EFKyMhz+INv9O8+TtxYfYI3SBprofFg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="fg2Wkhv/"; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733420997; 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=3sVBsQPSpwyLfYEIPOdm6XD2XQTQyrW9fL+uk5Se/l4=; b=PA71dJaUjOyDpA+6KCSL+ZuiUXNft/WSHkJ26O7i2A+zNovVy4u6LQJMp9MdpxzIusGt2U weREMhP/69kCLNZ1Gc1iCVK2KFVypi3AJiIFKgNmKZge7ugheGGkSxbA7Ponm0SS06ktDW HoRYleBCRRwnJA3JMOV2OsEez6/etwk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=3sVBsQPSpwyLfYEIPOdm6XD2XQTQyrW9fL+uk5Se/l4=; b=fg2Wkhv/pzgh0fJAbaTYhwkNNj Nd6w6cFbyzrl78/3O1MyoemEug9jy6AfzmUaJMJB4WDfNFPMJVxMrOxt8ag4WnSiqHbyqWxEfk7Fg cbQ1nuQ9A82HjYtWhQGRNX9GpdcUFi0ZIxAjSXFYvjFsLbM1LCw+Ge/T0QiZaqW98WRT964bQmzxC PG0MyCtBGdIECklG4OzTbTtm5C1bbTeWEchJJrIlLCOPi0nUtRbcnnKz/8/weLyri05CMptbe4Pzw /3pCAd6McskgTsV+w1l8uuQXFLXcwZcF7Qx+WAupdhZkqNmY/KDIFKiKA6415i/6u/Id3MSTkG7E1 j4UV1AoA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzH-0000000DN81-0f5l; Thu, 05 Dec 2024 17:50:03 +0000 From: "Matthew Wilcox (Oracle)" To: Minchan Kim , Sergey Senozhatsky Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, Alex Shi Subject: [PATCH v8 08/21] mm/zsmalloc: convert init_zspage() to use zpdesc Date: Thu, 5 Dec 2024 17:49:45 +0000 Message-ID: <20241205175000.3187069-9-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241205175000.3187069-1-willy@infradead.org> References: <20241205175000.3187069-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B75D716000A X-Stat-Signature: ao3gpchzifkyupeej5h7xowp46kyjw8a X-HE-Tag: 1733420993-311665 X-HE-Meta: U2FsdGVkX19KfPojqIsHyv/XtCjzQdvz6bEe4mZ09cjHzriYmTMIso9Gjwgnr0UH8SrVPMl0FEXGrnGvN//6m8g/zGDCRuA4yF9Se5lD0w9U8kofLhjjPpYfQKaxLBU+C2PlygF8Ik39LTKWeKuzWQ/NC/zKlopczjH1hsghLhT//1kTKZAUUe7ttOQ7M6aJH1eF+K9ubV7AOsuJ4RkarTuYA6B2+rsRCPlxSzyvjHLqDW73xjieT16r2/DAlEetL3tWwwueiy8x/8/qGvlcOkGLLlEk2dTBpeYUZimEdAf+BA1R4pem2MrwKOmGdXN+9YbROZcO1X8uRvvE6r2uJ/NPnyt0M7EA1l9AXZr3/OnPubMqnCO8yL2d2LEIep5+lMJcfMZaxaImDXlFJFDr+S/5YPaIyJ2aKiYyM2VmE8RakN7O+FDdwWWUq2RgsJqKJDVgPkCKGthbHahl1vCqGB9t9Ko4i3wlsXHkIFyvqmeTkeTzjx9LAd7sYkrjZiJgILeg7ZBJ9PQLSR5KWltw80wklz/MY96Fe+IJz1LYsxzAB4EHwRfrQb+mZxo2jtQclIxKIgunId3MmxNX+tY3yE4eEE3C3x7tPFcaYBTiuJGr3RQO/kwjl5FL1ajsZS9jQWAcBoJdDjvsRo0OtL8yP69/W2CtVYbrSALMf0avHtaQtsxfXvLgthzZfukk6556bnAJOkbb9qiCANj0M2C+eNU4RBMGp1uRd8uIRy2YaEQVrAD0V3VF5lDNlHMY0PRoOA6v6zHdwRlD3w6txghXgN5eF/pljFXtOLGdFMbZubviNKOH1GqUDBiL3e/k9x0cC0ekrRzeB9vKSnLP30ZyMjzolr8dVksnVyXbg0tTcypsc/Y+IWMTI6QSsxNDR3Tt3eaQvfyvtRSc9oPMJ/xqfuYNnmv7YY2YuDqPhjaLhsC4wqAsz0VbL67XPrG8vNjzaEaR90cf8pih0KT2WMr 5RoJUyAa dQF58ZK71XnIJd5QKvoNAy/cJYyhFyFIasvk8y8Pa//iqfXuEsyQddVDWtiI0n7CGoKM4GLL2ILRtP/FEAqMMf3jH2CoKHkxT9dWkhWlrsZHeMbTlDdD9ZhYkBto+EGQQP6cwB4Rd2JuruQ/dS36l0yZziRiGkfS7k4y0D+3MI4seoRxf4GEyQcxzW/zwJWXEp91/lgCiR2Pgn8kzWjBDUlB3Hd/1XW8F/G99yyDX691hrouvp3nhMAVpE+28xOmlwSq4QOATdezsLOsgyQIlW+oVVqpcVrnNd58VLMWckFu/3BpIuv0USVLLzgulGuyPNcjlaLU84+G1ta90oZEIROdbtQ== 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 894a3131ea2f..faaebc1514ed 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -943,16 +943,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_local_page(page); + vaddr = kmap_local_zpdesc(zpdesc); link = (struct link_free *)vaddr + off / sizeof(*link); while ((off += class->size) < PAGE_SIZE) { @@ -965,8 +965,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 { /* @@ -976,7 +976,7 @@ static void init_zspage(struct size_class *class, struct zspage *zspage) link->next = -1UL << OBJ_TAG_BITS; } kunmap_local(vaddr); - page = next_page; + zpdesc = next_zpdesc; off %= PAGE_SIZE; }