From patchwork Tue Aug 6 02:22:56 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: 13754325 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 DA78AC3DA7F for ; Tue, 6 Aug 2024 02:18:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68B6B6B00A5; Mon, 5 Aug 2024 22:18:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CE8F6B00A6; 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 421536B00A8; Mon, 5 Aug 2024 22:18:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 211C86B00A5 for ; Mon, 5 Aug 2024 22:18:31 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D4319160846 for ; Tue, 6 Aug 2024 02:18:30 +0000 (UTC) X-FDA: 82420211580.25.2482A03 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id 4E970C0017 for ; Tue, 6 Aug 2024 02:18:29 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QBV8krES; spf=pass (imf28.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=1722910660; 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=loEoxznJVMRwxobcpeKv3MGdFFg8glW/PKiOuSU8DAo=; b=wOhzsF9YIIjvzSxgkonpfxeamn2C+BjgfchTK3A9KUtZfBZCbPvaFeoeV2fpGItqRpo8yV j2yM6WfKSRHl3TxSrjapmJehyKqxEe8ZdJQgCOVc4RIcPBub3lIoaLyDH8OOE0ij6ThRzO zb8lUdTKfVIP9xtq33ESUfShOqIbCcA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QBV8krES; spf=pass (imf28.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=1722910660; a=rsa-sha256; cv=none; b=neCEgC0CD08gQgD8ynWAzVtRrf9qUS3K75Jzj2RHpPtCW1TbVB58On+wBNSkdxckimBT1P 0SgO6pDAGDcT2HxV7eAa1mQAO3o8vXs2Jgy4j4qkLlcc8g+iKZQMPf7EvEhEooHX9rvdJj BoEkDVDKhuHCHpWOHCOIau6W7zYpa5M= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 93ED860E93; Tue, 6 Aug 2024 02:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66673C4AF0F; Tue, 6 Aug 2024 02:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910708; bh=2XuUwCpmZ+NvY5bJ3CJbiV5pb57fdunEaUBcKFqNcHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBV8krESkVQBI1btdudXp3KnYlXCSSkzzl+6/65HHV3ctpQCaq1VOxmims7maxwHY wrBU3toUz1xv2/xTaEdWgIGqSdlbQT8ALHlvL6k9uSg7FUZoD2n3R9jk12A6+w3PPG 4p9Qjo2J8NR/4mJT1z2wuIu0hKQsn8J025ArD7UIENklvSYRCOSEarp8LcmPNjEITN fnG0iA0wTar2Lb2bdYWWc9r/imZYQ83co9ypl4Ct5PTBSrK62sZ/wIQDLljIBPQAks EsRG+glMxynyTvNGO7qfPVnLA3IEmk1uoQC882anPHSZqeNAp7qpEJjUJ8+3Lp09gw whxLi1wfKYSfw== 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 09/21] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Tue, 6 Aug 2024 10:22:56 +0800 Message-ID: <20240806022311.3924442-10-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-Stat-Signature: joas78mgqghe3twqqkorrrg1jsaakjfr X-Rspam-User: X-Rspamd-Queue-Id: 4E970C0017 X-Rspamd-Server: rspam02 X-HE-Tag: 1722910709-239819 X-HE-Meta: U2FsdGVkX19b7e/iaReVmwTVDqPkT1S2uV2IHYvVrBOa6UDJhCtCVogWvrrMj+x2qYbvLYr3fXblLcQcqQoJJfXg2cjulCi+zxp5MrJfn5FXoTsRH9geNbmoUU609jIATA46M0Zw+5MGsvbCQ9TUq2n3dMt1TEVZu/9IYluzZye316nRzJ7xmT+k0r0gw6B70sHHwcYn9lDyk3CXnVKc7tVIeyDjoeKyUFVUMIiDj5hb8fvSCgtmPutmYi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4kBUUvi5t/WEoEGxUTVHJ5563YqI50HRakB6fXE6TOth4ABW0tDpvpxRl2sGlkE 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> 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 d7400acd0f01..5fac2bb436f8 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -800,9 +800,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); } /** @@ -1476,7 +1476,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; @@ -1490,8 +1490,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);