From patchwork Fri Jun 28 03:11: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: 13715391 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 E3019C2BD09 for ; Fri, 28 Jun 2024 03:07:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E3A36B00A0; Thu, 27 Jun 2024 23:07:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46B716B00A1; Thu, 27 Jun 2024 23:07:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BD546B00A2; Thu, 27 Jun 2024 23:07:11 -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 048DE6B00A0 for ; Thu, 27 Jun 2024 23:07:10 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 863D7141391 for ; Fri, 28 Jun 2024 03:07:10 +0000 (UTC) X-FDA: 82278811020.05.D6059EB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id EBADB1A000A for ; Fri, 28 Jun 2024 03:07:08 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="fLwz/ccg"; spf=pass (imf19.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=1719544020; 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=jevAal48WDlrKGLs2X9bbhtwUXQfBf6pD8AnC8XCHek=; b=6es8kPQiUsOKw/qtnSdoecONgrnmMe7pCs/gpF+vb11A3GYxGgFniZvTI78Cz8a51/A3H3 MELuHAf2QIyGh89te+FMhvF1Nbf7DJ0n1MuTRBdlwm0Wn4mW9nIFDL9FEEO/qi8zQ+3JJ6 SHogmHT7apVOrPv9yahpJZxI6s61xXM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="fLwz/ccg"; spf=pass (imf19.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=1719544020; a=rsa-sha256; cv=none; b=of6P1jGsSCkQT1hURqKvjoYJBt3yrvYKOYJSAnjQ7h4ktEKlgaIeyjk5ORYe8rEfn9RNqS hfxvruoFw/2liBzCGQUcUQtAvlqpfzgRcHlmwbTxvjZxf1ON/Q8C04y/UhlMaOQjfjp+9+ xRYmaZ8A52Tn155MW5rg337+5YFDlb4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F226061DDD; Fri, 28 Jun 2024 03:07:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBB16C4AF0D; Fri, 28 Jun 2024 03:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544027; bh=XjQFvUcS1LHsRYGu9jnBiByPT0wYykOdlBmIkN2FtBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLwz/ccgEUbpiJOrFdS0JKWIACGuXo9B+lq1ll4r21yihrI4awNMbyxM+XE5ayHG3 XmK0O9G0zjrm7ibjLcKlK7WBFSzMn2Gj8217qv2X5CDFdM/u9I3EbeRkl+JrtaKfhk fQ6Wq3h+qXPYeahBSmHYSfSArtmajGSvBL7BsbIMmiX7e2BxiJFzWn5ngTydX03V+G LktDfp1xBOQ/s1nuxJRcdFMD2B//pwJQcQlM4wn4D+o3HzI8hd6yKYVAbQ7DLK6KOs dKisWok1zVs65YDd7PhvkNMpwpefhHE0rYPzWAo64qeHnYsA5F9AxbF+bN17yxu3iJ +IwgjYNBRM6JA== 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 Cc: Alex Shi Subject: [PATCH 05/20] mm/zsmalloc: convert obj_malloc() to use zpdesc Date: Fri, 28 Jun 2024 11:11:20 +0800 Message-ID: <20240628031138.429622-6-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240628031138.429622-1-alexs@kernel.org> References: <20240628031138.429622-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: EBADB1A000A X-Stat-Signature: h3jdn7m4djnungfbxk7tsbj6g7dkafsr X-HE-Tag: 1719544028-257540 X-HE-Meta: U2FsdGVkX19qU7FHqBYImz6bBZSEMnsudlhuz3sorMrriPmKQrVWddOGebStmtYINr63sq7XCA0NRGmm5y9AptP1pL0JnAJXp9XuoqRVzdrH0qkYmb21t8R/UkpexE6LiTJtLVYE/uvHo10mDgcT+Zu62oSwreP7XeN0OgC+IDtRzcn8pKbOIe5juqxUCzNn5X1/7znoKA9922AEaQPNNu4/5RpFhaxLvtnFATYM1injkT6wrm2T11WDu3j0fWidioiP1MlRwMy2L8iezX6vloW1ysVqWUM89cg7e4MLLqhs9L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Srn6uRg== 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> Use get_first_zpdesc/get_next_zpdesc to replace get_first_page/get_next_page. 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 efb1d58b3c36..137b36515acf 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1324,12 +1324,12 @@ EXPORT_SYMBOL_GPL(zs_huge_class_size); static unsigned long obj_malloc(struct zs_pool *pool, struct zspage *zspage, unsigned long handle) { - int i, nr_page, offset; + int i, nr_zpdesc, offset; unsigned long obj; struct link_free *link; struct size_class *class; - struct page *m_page; + struct zpdesc *m_zpdesc; unsigned long m_offset; void *vaddr; @@ -1338,14 +1338,14 @@ static unsigned long obj_malloc(struct zs_pool *pool, obj = get_freeobj(zspage); offset = obj * class->size; - nr_page = offset >> PAGE_SHIFT; + nr_zpdesc = offset >> PAGE_SHIFT; m_offset = offset_in_page(offset); - m_page = get_first_page(zspage); + m_zpdesc = get_first_zpdesc(zspage); - for (i = 0; i < nr_page; i++) - m_page = get_next_page(m_page); + for (i = 0; i < nr_zpdesc; i++) + m_zpdesc = get_next_zpdesc(m_zpdesc); - vaddr = kmap_atomic(m_page); + vaddr = zpdesc_kmap_atomic(m_zpdesc); link = (struct link_free *)vaddr + m_offset / sizeof(*link); set_freeobj(zspage, link->next >> OBJ_TAG_BITS); if (likely(!ZsHugePage(zspage))) @@ -1358,7 +1358,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(m_page, obj); + obj = location_to_obj(zpdesc_page(m_zpdesc), obj); return obj; }