From patchwork Mon Sep 2 07:21:24 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: 13786837 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 60DC8CA0ED3 for ; Mon, 2 Sep 2024 07:17:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E47128D0090; Mon, 2 Sep 2024 03:17:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD13E8D002D; Mon, 2 Sep 2024 03:17:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C231C8D0090; Mon, 2 Sep 2024 03:17:20 -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 9FF178D002D for ; Mon, 2 Sep 2024 03:17:20 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 61E681C6417 for ; Mon, 2 Sep 2024 07:17:20 +0000 (UTC) X-FDA: 82518942240.06.F8A714B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf10.hostedemail.com (Postfix) with ESMTP id C799BC001C for ; Mon, 2 Sep 2024 07:17:18 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NPeK2NyV; spf=pass (imf10.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725261345; 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=8gWzCjoezRQSWIxwCRcWSKNiYPU+Pq1XTxenr8y5cc8=; b=DNnsX6JkrzJCI8h/OfHXnNVCd1Zn8BxJ03ekuFygmKkz8ZGo0dlUZ9LzufCONxnfN28E/w UiCNSwiLSP+VZ5jpi6c4sB9L5PVLgMIQvo7y50aDuxU9rTbzcpTzsur8xFFPGdGRQJpva4 PvczZsPF2QfRGjqBY3eoox4edhcpUYU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261345; a=rsa-sha256; cv=none; b=1Hnx6ilNiyy5oNMGuu5jxDHki4OwaETiYcYyy/lcb7yYy12vvbx3BIoxu0OwHDl8SOhr+x r2ZyYi0ItEwtirSxDbJWdStna2mTAxIkIrbNXAm4oeQu0DOM0lGz8GzcpDu5gXZqAjvmB6 x/6Up8m2l60H3m3NuAGYTfyJlaBHnx0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NPeK2NyV; spf=pass (imf10.hostedemail.com: domain of alexs@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 23FADA41725; Mon, 2 Sep 2024 07:17:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B362C4CEC4; Mon, 2 Sep 2024 07:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261438; bh=XMY5jg562sPF99BloXKZJR4HKiDGqicXgdq+2ws9Iy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPeK2NyVAp/tWckPu9912WQybh4F4gsYJTs+6ho+SST7R9QNtr+Wb0XlHgJI0twbc 3bINCAfA5kKpMF2Q7PrN+D2xXHoHSQd9M2nsfbhEmvC/kMGUJtZQ40YI+NCbthEAvB 0XPZVe6lyFovwfqWR2rNwDjMaRrcBQisjgCtJWR3reZwYuJFQnCsYbgAbxvefF059f UZ/3lSpf7g0T4mVBjpcJUPdNbwoy2hnea6sYvK8VwRlZ8WNWuyv4oGjYdw/iHVS6Z9 2kAImmM3/NlKqL3WG288/KRhAfKLnwJPAbm9U7O9TIdjYTmFD4EvUA93+Y3WuOibN1 KTCCtWBhvfP2w== 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 v7 13/21] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Mon, 2 Sep 2024 15:21:24 +0800 Message-ID: <20240902072136.578720-14-alexs@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240902072136.578720-1-alexs@kernel.org> References: <20240902072136.578720-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: zzsszagabrpsg3tn8nfsg9cnxmtpero4 X-Rspamd-Queue-Id: C799BC001C X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725261438-623583 X-HE-Meta: U2FsdGVkX1/6AQG7M4YRXdHiJ5QyKW8wNtnY3ScpWxR5uEcoNKxfK2RBrctBESa3PyQGXcO3Y6XzgIh6gMJDW4hQNaH6r8fjwnE0ySVduK13TtC0+Zz1LX4yDIgLt4qqp3wGzXrkvfszqMCV5eOYoF1jy1aASqKhx7Sv+Xfk9gdp6xkrtNZW8SkZM2bSbYxJkPCmt3h10q6fMVVlrDyyQaFlZOPAAcVRsgCSuQlIwnG/jplXnsCRIdHzPxp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ZWfXBy9DijEBd1L1Zx7jMyYcAnvVXJO1qvuW6RnsQbyAkWm6zMxkU8 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 5a8fd5fbc962..f94c3a6653c7 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -814,15 +814,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; @@ -1379,7 +1379,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; @@ -1866,8 +1866,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); } }