From patchwork Mon Jul 29 11:25:25 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: 13744736 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 E66FCC3DA4A for ; Mon, 29 Jul 2024 11:21:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AAC06B00AA; Mon, 29 Jul 2024 07:21:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 659406B00AB; Mon, 29 Jul 2024 07:21:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D2736B00AC; Mon, 29 Jul 2024 07:21:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1DF8B6B00AB for ; Mon, 29 Jul 2024 07:21:03 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BFF8AA02A1 for ; Mon, 29 Jul 2024 11:21:02 +0000 (UTC) X-FDA: 82392548364.10.2C51084 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 316C5C0023 for ; Mon, 29 Jul 2024 11:21:01 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=soKprBYq; spf=pass (imf22.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=1722252007; 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=wXagLVGUZ9eebRl/j1Zz+wClVG4D6z7RAED/mWVOrM4=; b=gZlAswAU1LK4xHwrQpcCRl/RbK2XVgJ7zmQsjMICz+I/Itgj+K1ocaOXOc6+0Y2d6SGGK2 1NR6jdlvwGrrmQ08QSatfoUamIZfI16Zacq4hncEWNpccsercyt1s/t0Je+XGv74Mb1GGU KuOHHe/4XY19gwafdS2M/Cf8h1dHX80= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722252007; a=rsa-sha256; cv=none; b=BtacN0J+LV4RYURf3S987rTxprY1hdBscyIqiLJ+g9oziQ9QcJpLGmLwsgpCycE4LH610X PIcutcV2LwX0yn2Gh749bqE/Q5Pu8DTW8oY/bXymEAzgFL9yiKQ8PaM0H0SpS2HJUNdtvF A1bjhhh9Y/6K+Nh0/c9VrRItiynj320= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=soKprBYq; spf=pass (imf22.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 73C28617A4; Mon, 29 Jul 2024 11:21:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64837C4AF07; Mon, 29 Jul 2024 11:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252060; bh=wTDI0eYHYt7QQuqfYVSh3nHEsVuSO77v1MHzFFaeoFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=soKprBYqWURfg25sfItqMlUmjCEOrgiYtNAVU0eDQr68G1KVfp/73qZOeW7TOTupC a4MzcCvbu8bHoU4pupUZtFb30ceJnWgg7D5Dgq74Dc8Lu42X2pxdIrA1XU8XJoRuTr XKCxYMaMOprZnX8ZS/+ih6s8whodTe32MyaDzTAgQr/CuJ/erKwRgmD2ZTw0b73hGS 1rQiKJMZNSv8vii8ZRFqvcMR1hnxy9BF4gx+gEwTHVcXLWhB4Fap9uUH9Om8FWwo13 O6qln7YSujzOPOMEVbMY6RhnaWzjgGqu53rtHRuM8XNeT3KFntHVNBXeVkhf4nO+Ob 8tHZuDQsRuUMQ== 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 v4 13/22] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Mon, 29 Jul 2024 19:25:25 +0800 Message-ID: <20240729112534.3416707-14-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240729112534.3416707-1-alexs@kernel.org> References: <20240729112534.3416707-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: dy7sxkufy7j36i6sd18dingckpeedshi X-Rspamd-Queue-Id: 316C5C0023 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1722252061-605174 X-HE-Meta: U2FsdGVkX18LQrFZU1uvsTvt6ny8TNtp/2jQdjcJ5DdPBDRkRLApdMOrqOjufDicBds1XGSyeUwe/GVyRYXvG7/iCPrNDH0WarEUF53yvWHFXhw8Ngi3e+q/BR8GSBvMFxu97Kkyp1lxCtmtBDUmDYLssDudTcQwrW/OoC179VQbDt+5anFD54UE8uS6cP0srz/+SWt8NAgn3KZtVEsGkNiE/34dH/93SzMRf9/mUhgplsNdTiNRyh/pl9Xdg0yMwIS6W60trBr4jm2DS0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3fmj3jwmsXIf 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 --- 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); } }