From patchwork Tue Aug 6 02:23:00 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: 13754330 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 09087C3DA7F for ; Tue, 6 Aug 2024 02:18:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD59D6B00AE; Mon, 5 Aug 2024 22:18:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C88036B00AF; Mon, 5 Aug 2024 22:18:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B262B6B00B0; Mon, 5 Aug 2024 22:18:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 887816B00AE for ; Mon, 5 Aug 2024 22:18:46 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0C546C07CD for ; Tue, 6 Aug 2024 02:18:46 +0000 (UTC) X-FDA: 82420212252.21.113CAF7 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 6ECB0A000C for ; Tue, 6 Aug 2024 02:18:44 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CRmUrjTQ; spf=pass (imf15.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=1722910663; 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=26gYv77REOrP+tSsekzSzMy/5K3dzn0Zx7gMUrX39Rw=; b=HWMFXFrQNkHauOvjSdGcjFc/0ffY/yXEObdxEDoa/C2Pj9aNehNJNJLVgzmETJediOlS5e yQGhKduxp4tsJ6sNykz1zq2PDbPzHIUylse1m8Pgpvlm6X+YfQqZwDmo4GAdDvxc0Vudgu 4z7GoxgPUm9dBU1g0l6/v1wkcCzGsbk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722910663; a=rsa-sha256; cv=none; b=qJYJtwlkHbQNMIyOU3cgl3qiGV1NaXw7pjhaNDLFDPrzN2Zy8Afpsmvjhd1x+cGo5sk6zA cLGqFj/YEQrsN17iZbn8LhP8B53kTAWHbzP8lLKmc9npIEZIhN76cwSHUMj6/0udXper+5 xRsDY2PXrS7ZsfvPn/Kvfvd3cORS4Bg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CRmUrjTQ; spf=pass (imf15.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 A4BE160921; Tue, 6 Aug 2024 02:18:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34CA4C4AF0B; Tue, 6 Aug 2024 02:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722910723; bh=7R27PI6t8PPGIzjMbda+XNUteaxs5t0PfeOafdtKA9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRmUrjTQbKnuPQmOwufiAx4cYw8y+lYQTG38+7FslMxb3MSpH7GyZODkN1/ZB59fB s8imNPAIKMRXmNKRZK0mUiaLhD+0PgbBtXwT168RS2gd2u58Rg3m104ej3wIe/snzs NjG9ikTjq5ki9Gnay0a4shcsPz1sNZb4rTFy/MQsccnSfB32pVwCaqCPwnUL4La9DS TWtv6u+zy+LKEbXrV6o32O46jbrvR2Vg73CGnzTQFa+/sr9+klLHfr9ul2ZUl55YGl dcLUtMdq/ti4ucNX5c9ViRpDob04PaaSR2Fjff3vT5pmKjMGlolcDuytY0hd9wT7Fe 85JxlEARg1HcQ== 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 13/21] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Tue, 6 Aug 2024 10:23:00 +0800 Message-ID: <20240806022311.3924442-14-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-Rspamd-Queue-Id: 6ECB0A000C X-Stat-Signature: wmxfpfzmrgdgunjo8we3uzi7w1ahuy41 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1722910724-487558 X-HE-Meta: U2FsdGVkX1/wNu0153g2RSyufI8GfjXRkNVNBiTeFYtaVY8mKs3FaochLVee/RV1SsfdD1egnlASZ1tLOraIg358QilkfhHl2aPlTxapb6vBc8qKNPxm9quDW+OWnksohkanbeiSbCrglEl/BpLvnBxAxkHC3RwbZ2tGgJP1qGT4rmnpJNzz1FUp2SW5JxBTlPyI+T6+IRW1beGxUjYMNlxOHERFt8FWWRzoHGmLMaTsXCM65q7aMzfyW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FlOK2p8jUeEtvSiqWmstQRD3JVljqOwTYQNU+Cn3y4glOEIoVi58 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 4b948b84e7f3..e6d1bd8969e5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -806,15 +806,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; @@ -1372,7 +1372,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; @@ -1859,8 +1859,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); } }