From patchwork Fri Jun 28 03:11:28 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: 13715399 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 C7AB7C2BD09 for ; Fri, 28 Jun 2024 03:07:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4979D6B00AF; Thu, 27 Jun 2024 23:07:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 444356B00B0; Thu, 27 Jun 2024 23:07:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2989E6B00B1; Thu, 27 Jun 2024 23:07:43 -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 048656B00AF for ; Thu, 27 Jun 2024 23:07:42 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B9E0B161438 for ; Fri, 28 Jun 2024 03:07:42 +0000 (UTC) X-FDA: 82278812364.01.9C40993 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf27.hostedemail.com (Postfix) with ESMTP id A41EE40017 for ; Fri, 28 Jun 2024 03:07:40 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oIUTcWXK; spf=pass (imf27.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=1719544051; a=rsa-sha256; cv=none; b=bmZGkIc20tcsO2STFCDK+VblejKF+66iLYJnCtmnQIBO3bGoaFMiXacSxIR/lVvm6NEmlt WjvoOZFxIGGOegKn3Qwy8eOeWNgZlr/WgFpBvOhJjScwBKUuFzV+S19fWgt/eVm0KF574v UBCyzSVDo8o0zmd1iEgDThWYwdYeCVw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oIUTcWXK; spf=pass (imf27.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=1719544051; 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=CDWNHuXI1LJKO4XxIIxJ4PlMSqJF0GDetzQJMcSAuJg=; b=fA7+A+J8J1zSD1KZqBnPcWrwAVvseKFVSsyO1GkEvWmxd+CvcX6m80rmo6JXiXgZt9bD+9 Oe7xMGLEtlaSMZzIVVwGEQv/Xb/spHm/nvBiDCtN5AsyRXTh2QoCeKq3e/Pm2kFDyI6Y4K RQ9IEqzNS/sfwkqjxWC3OLGm1X0v+8A= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C0516CE2F67; Fri, 28 Jun 2024 03:07:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14C8CC116B1; Fri, 28 Jun 2024 03:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719544057; bh=gedDp0RHU7Zb19ZIAumudrHJ1RWmViS9C8nGeod0zds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oIUTcWXK+xs8W0Bn+nZd+E2zqjNEJ8xxmE/ynQKaenuBx0s++2m7yO67tPFf51YlB QNtpHUsRZ3/KM9uiJkqmmWApsGNcD5Z4brLMBJm7rD9XT6E+m8POORQcq0+eM6IZhX A3xTV3/hWWTqz+QxjbnhnqWH3t0NQdJefRAGWm4AaAoiasyGi7TJXpct7XkGKoyPEf bo8vRCiWJxJtEFuXHFms5scP7tUJ2i+4wyOJBLnYWfUmoIVDKACDbY8HbwIfv5bR8q OPBReFRDgjZSfMO/MF1XAy2s/p8kAdKbeWbZLIC+70s8CeBaHItKYNJoWCiVttKUU3 6qDrwLqLmgX3w== 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 13/20] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Fri, 28 Jun 2024 11:11:28 +0800 Message-ID: <20240628031138.429622-14-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-Stat-Signature: homo8e9bqtqf3eix6qnj9o4cyui9paep X-Rspamd-Queue-Id: A41EE40017 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719544060-921539 X-HE-Meta: U2FsdGVkX19rQ8q2++KTFo3HkbfTdLkZcARGpNrgkKPCQkk96sbjkYzx8H/kZfGZA8V84hbxKb0r9wnzdHrBEmMGyoyThKo+fYOzqKYPtdNc9NKl2oIcidGSU+u0CGnhX/zDAMUT56iJ5SG95mukz7XLFaY6gd17/svvjZdtl0v8oBoYZIhg6pRHqCSK8zvyWAVI/YOgUvwHKNKkNfZ5CDvBXFi07539b8/uSUliRu/ab9WwUt9YIVIOe4q6R0jZq3zPzAIHn5K11FNbOyurv+4PM0NNrdfHfapKhXU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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> As all users of location_to_obj() now use zpdesc, convert location_to_obj() to take zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index bf5a1b63bb17..e8af01768ae0 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -828,15 +828,15 @@ static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) } /** - * location_to_obj - get obj value encoded from (, ) - * @page: page object resides in zspage + * location_to_obj - get obj value encoded from (, ) + * @zpdesc: zpdesc object resides in zspage * @obj_idx: object index */ -static unsigned long location_to_obj(struct page *page, unsigned int obj_idx) +static unsigned long location_to_obj(struct zpdesc *zpdesc, unsigned int obj_idx) { unsigned long obj; - obj = page_to_pfn(page) << OBJ_INDEX_BITS; + obj = zpdesc_pfn(zpdesc) << OBJ_INDEX_BITS; obj |= obj_idx & OBJ_INDEX_MASK; return obj; @@ -1395,7 +1395,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(zpdesc_page(m_zpdesc), obj); + obj = location_to_obj(m_zpdesc, obj); return obj; } @@ -1884,8 +1884,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); - new_obj = (unsigned long)location_to_obj(zpdesc_page(newzpdesc), - obj_idx); + new_obj = (unsigned long)location_to_obj(newzpdesc, obj_idx); record_obj(handle, new_obj); } }