From patchwork Wed Jul 3 04:06:03 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: 13721083 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 3C5F1C2BD09 for ; Wed, 3 Jul 2024 04:02:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C23416B00A7; Wed, 3 Jul 2024 00:02:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAC796B00A8; Wed, 3 Jul 2024 00:02:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FE496B00A9; Wed, 3 Jul 2024 00:02:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 71DDE6B00A7 for ; Wed, 3 Jul 2024 00:02:01 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 39F1BA24C9 for ; Wed, 3 Jul 2024 04:02:01 +0000 (UTC) X-FDA: 82297093242.17.C4548A7 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id A138C4001A for ; Wed, 3 Jul 2024 04:01:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gVOc+ikQ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719979302; a=rsa-sha256; cv=none; b=PFEY2UwQbWtNK1R1RPr1cCOaEalhVS5wZCpDP7SFWjcFz2EGaZMD7oziJ29TwDl/k+Dnv/ cDYttgqZ9rD1ZnbpeBIy8P8TeYj0sjBFX4BMLM9bxX3eS2ZyBHWSZTFo9leEuqPFkmpx/x kVN4w7UrumvvNRpJyWBuhxzAaLezyxo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gVOc+ikQ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719979302; 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=hmIkb9IWTHG/Yru6hnUUKMhzxh0tMgraHUhiFM+POE2YtZDZ5hC8bwWh2fLpXkTAEW5PQG PB+F70Cr1sPCoA/lxy5KEOzBxGilD8y3cyCQf3+X9/PycRCY55eIZ/uae6QsfXN+i6DWnV s113428VCDWL3a8Ra53nyfy7uLrARFA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E818F620FB; Wed, 3 Jul 2024 04:01:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74B10C32781; Wed, 3 Jul 2024 04:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979318; bh=wTDI0eYHYt7QQuqfYVSh3nHEsVuSO77v1MHzFFaeoFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gVOc+ikQ0e4uEf4lRf4VFTkicUepq4dYTbwtWmScFz/shEGC3tPJ2Tv3kp+jVx39J 02cNh0BzDrMvoMSkuZTHsBlPZovMNzYKU9VGCsNc17yGimfEVfQQ3CNb5lzuXAIK+c vLBE7IJcOkdN1BRsM4pIX8l88EuGTlaSwpUqFmKj6l44HiFqFjGNl68SmrkQ6JlwlG YEv7zNYxkcmEBnWJ62sBfJcYrEnUJwxuyTJf2Kb6E3+qL3UZzdAq666Nr3NlRFnIgS P+qbUaMur7AJrvXSuEPhRwv5psWkuwXQGkQc7n1tj5nhvojIeOMofVoEn+JGscY7nv qedKqn8ZvIBgg== 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 v2 13/20] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Wed, 3 Jul 2024 12:06:03 +0800 Message-ID: <20240703040613.681396-14-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703040613.681396-1-alexs@kernel.org> References: <20240703040613.681396-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: A138C4001A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: dbjarntndzgikxj3tb6t9p8un39wfgea X-HE-Tag: 1719979319-985193 X-HE-Meta: U2FsdGVkX18bpWYbIlO9QcAX2r/oNLzCtPYVDosus453bAIN4xi42PU04pDaLaLGNCRT+cSZ7N3J/TwNkpv5MVNmtEtgmDpRcfgG7JfPBdgFHrQpipP0Nx/79LPuGDxWO+Ds+mQki//JIjiR4qu3DFuftYIdj9RESl9RF//NzQyQ1NUu0webyUkkBu3+1wb0MVpmVsM7U+YNjYUpEIuam8HqGmdkfvjC/5eses/qll08yH8pW9CsQlhNaM74L2Ge+XZZoXv2810UA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htS8zpnZo7ZaxgRHdBvP 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); } }