From patchwork Mon Jul 8 06:33:34 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: 13726201 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 E0A96C3DA42 for ; Mon, 8 Jul 2024 06:29:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C0686B00AE; Mon, 8 Jul 2024 02:29:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 570096B00AF; Mon, 8 Jul 2024 02:29:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 437CE6B00B0; Mon, 8 Jul 2024 02:29:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 227106B00AE for ; Mon, 8 Jul 2024 02:29:36 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CFA7A120F47 for ; Mon, 8 Jul 2024 06:29:35 +0000 (UTC) X-FDA: 82315609110.12.E5F1E25 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf15.hostedemail.com (Postfix) with ESMTP id 99B1EA0023 for ; Mon, 8 Jul 2024 06:29:33 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SVk5iNSo; spf=pass (imf15.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=1720420160; 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=4tJHBOc18GmiecRtdLoq7MoV4LMDbclFzcv0ZoPmA08=; b=yhJi5GoAEDd+w1lnhCFW5wJ/R3B/yJ+MohQiRzbYEFAYR5d+vzxKXfE6UgoPxAoIzSwFIv 4mCiMCxKvUDx+5bWk2nAnUil72TaaBSzxeplAIv9S0i/1VK63Kcs7fLc2wxc0sESuOjnQc ediEaxuhF78dZsg+EuQp4WTT7b6ZtiI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SVk5iNSo; spf=pass (imf15.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=1720420160; a=rsa-sha256; cv=none; b=NBqmBZlfT6pfcZVnUMbeR5ydgJ2Ed6SWahby8eKZgqYTF+uTFOvTBDvpA4RBw4SENaPrEz G34yMRglpY9upKTsLzkqH568G+050QRw1gnlIBNb9Gy3neo3VDOhT+06br0oE494D0SGkU 01wtup5DrYTYOl8VX2lbXEMeXjY7AVY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A9AE1CE0A58; Mon, 8 Jul 2024 06:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C84C116B1; Mon, 8 Jul 2024 06:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720420170; bh=FoPFFhZjgJ7k8SPuHkOnh4ZOuMsrgriGi5An3x0tRys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVk5iNSoWEypU6s06xUAyZFEaiQ1Lg9SaOx3SHhS8HIM3gOa6jnzHjXuVpb7C+u+G CUS6gTMu1aJOHfYMh1aiodRaOueC1INYKRIwcbJuEHMDRzbhoYUUdn+dw/UhRWFQPb YOqyBMdjtfNuVZCvBM094GknA+ub5pPohmKxG+mvZ+Nm6SKp7IV/SH+zPDLRreMD2G sucCviNkh1ywa/cuflg9Ocj6Jy66eePgmkIiHVrIOVmO5I4t6DiBpMje8pB+6w7hz4 FOMaRLVBR7AfGWwpT4+oLOQkdenToTM2w5UgRWJw1jw7MRLjGW75nLcW44/UPvFNgM KHaM1Hk6JxHRw== 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 v3 13/20] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Mon, 8 Jul 2024 14:33:34 +0800 Message-ID: <20240708063344.1096626-14-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708063344.1096626-1-alexs@kernel.org> References: <20240708063344.1096626-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 99B1EA0023 X-Stat-Signature: 98c4sz4y4nx6nxogohg9jz5w6ekw66g7 X-HE-Tag: 1720420173-673197 X-HE-Meta: U2FsdGVkX19Ov5berM7Rbw5pJ2HQbwfo/9p7JaXx7jvKDX7m9+pWmjcpu2Dyly8TWMWx5IEAYq8C8kr8GbSl0qGfHNCWKCw/JmkyITNwhV40ZdO1NfiW/CrTJnhtvA2lTMlCipzD7LaPa6Ak2qBkQ1CZvGuDMcW9T8z3922cUVEqaq6FU1qcR/mdWpXttNj2yNbUM+hbMpSYkif0zxNusHD8bP6hzQQp5sWBvt9uTZOpXBrCPYrKWmSajW4zILwIm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Xok2r+7gS4ch3hdLT1jf661Q== 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> 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 (Tencent) --- mm/zsmalloc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 68fdea7b6e0d..e291c7319485 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -826,15 +826,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; @@ -1392,7 +1392,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); record_obj(handle, obj); return obj; @@ -1879,8 +1879,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); } }