From patchwork Fri Jun 28 03:11:24 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: 13715395 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 17B48C30653 for ; Fri, 28 Jun 2024 03:07:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 975946B00A8; Thu, 27 Jun 2024 23:07:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FEE56B00A9; Thu, 27 Jun 2024 23:07:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A01B6B00AA; Thu, 27 Jun 2024 23:07:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 580756B00A8 for ; Thu, 27 Jun 2024 23:07:28 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 155A8C0247 for ; Fri, 28 Jun 2024 03:07:28 +0000 (UTC) X-FDA: 82278811776.26.8B297A6 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf07.hostedemail.com (Postfix) with ESMTP id 1694440007 for ; Fri, 28 Jun 2024 03:07:25 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=asuZ1JAY; spf=pass (imf07.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=1719544038; 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=dkDz35KBFrYW7wPgX7YzbuXqXCKGmsvzbaAgomoLgog=; b=3eIJt0/JKYkuw+VM5BWoP+eIddoSilX87PSjek+4BTWV/s0O0PODTe6BO0nZ372ENKKuWO qpvlfkTA88J6JeYeWQPJsSdV19ryWT51H5P8swENvOJvYVPiiF/dTOuQlVpev+ygz8qQpg jax9qkWmAjz5QSYCA8STnedmIfT9xQQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=asuZ1JAY; spf=pass (imf07.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719544038; a=rsa-sha256; cv=none; b=njvw/dLxIFPL5AmTey3jfaXLY+U4uX0M6Hyk3ONm9t0ZDbxvxK16gjjvEQBQhZTSW7R88X Tx+Qw28qOafpChnvKT0/eOYJT3eKLHegveCG2ArIX2l7oIYkW6E4OQ67pAS03kzzuPzG7g kJOAJK5cZdB9wYQ89QppzwsUirSbjrQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 36627CE2D83; Fri, 28 Jun 2024 03:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F2EEC4AF0C; Fri, 28 Jun 2024 03:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544042; bh=f1FIB9i8kXKQZtzU8kTMr1QDsZX4ItRyZ1ReJH3drr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asuZ1JAYGbKula5yKxocWKi3XyNBBP9kf53ah/IL0JHq81kjKvUKY3mJqyO7C04nj 55mdth8Bvias1bnoJbA9Yl82dad+PZtD0AdoIoQCbd/rEiLLmUVt7peD2R1uj4Z+kh BbN31tKf37MrNy9lcLxSbysArq5k0GH2C6A/e3qUjSoUddir51w3pGo6kBtLKfhBSB 39GgUBPrsDKVMJ+53C1BLXuD93wxHgw3Se1SSYCtGZTJWr3Tstzvbm8LDFTQIZH8M2 3ppPPAsXRhXnYvn8MycTdHq/au5R9QsL3F0ULCwRm7axJh4eFmoRLDYbAdbETSgYvu k1jLByx8bIr4Q== 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 09/20] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Fri, 28 Jun 2024 11:11:24 +0800 Message-ID: <20240628031138.429622-10-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-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1694440007 X-Stat-Signature: 3rdoo79b6f11zyqpuyc6u3sqb5fywb94 X-HE-Tag: 1719544045-557871 X-HE-Meta: U2FsdGVkX18AOhwXAY+7ln5kcm/te0U9ruIDGsKX7Ky2YplQXJmWLxPbWrHexkxWlMweOV5F0ZrF1ocPw+hnZ1cKDbgLeEV02b4KKEfOYGVMowky3P8zjYpD3EG9ydH+cFN9fG1oRgtzM02ZjHSBNxQGDtJOfancJqlb3Z0Jx5ZiabWb+oF49cSeC9l7D1P91rzaKSvIi90UazYGFpGjjIJ02HQJVXORg445S/sbUjcMbak05jVcfe+MafcXZCFJNiOwHkQQ5UpNFMtwLFnKXYS9bAWFr7FCg4FPIg5q9xTBeb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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> Rename obj_to_page() to obj_to_zpdesc() and also convert it and its user zs_free() to use zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e90e3a638068..3ef8e13fb9e6 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -822,9 +822,9 @@ static void obj_to_location(unsigned long obj, struct zpdesc **zpdesc, *obj_idx = (obj & OBJ_INDEX_MASK); } -static void obj_to_page(unsigned long obj, struct page **page) +static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) { - *page = pfn_to_page(obj >> OBJ_INDEX_BITS); + *zpdesc = pfn_zpdesc(obj >> OBJ_INDEX_BITS); } /** @@ -1500,7 +1500,7 @@ static void obj_free(int class_size, unsigned long obj) void zs_free(struct zs_pool *pool, unsigned long handle) { struct zspage *zspage; - struct page *f_page; + struct zpdesc *f_zpdesc; unsigned long obj; struct size_class *class; int fullness; @@ -1514,8 +1514,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle) */ read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); - obj_to_page(obj, &f_page); - zspage = get_zspage(f_page); + obj_to_zpdesc(obj, &f_zpdesc); + zspage = get_zspage(zpdesc_page(f_zpdesc)); class = zspage_class(pool, zspage); spin_lock(&class->lock); read_unlock(&pool->migrate_lock);