From patchwork Mon Sep 2 07:21:20 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: 13786833 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 CF6F2CD13CF for ; Mon, 2 Sep 2024 07:17:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67F1E8D008C; Mon, 2 Sep 2024 03:17:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6078F8D002D; Mon, 2 Sep 2024 03:17:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A8888D008C; Mon, 2 Sep 2024 03:17:07 -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 27AA08D002D for ; Mon, 2 Sep 2024 03:17:07 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D2989C1948 for ; Mon, 2 Sep 2024 07:17:06 +0000 (UTC) X-FDA: 82518941652.16.685768E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 436E4140011 for ; Mon, 2 Sep 2024 07:17:05 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=WbsWZzPz; spf=pass (imf23.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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=1725261333; 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=+i7qlOLu9s6ZZFQdVUBkJ6vmPIqVVf8R13g8kxpIl2s=; b=A8asG16gpr8CjGNLoGk1e7gQlx/cvtok4j0uV9fqM8Zhql+LfIhDdd+aHgc1FaQ7lzavaz McUdVSaCzm5tsIRBakLrAG/SCrC2Gd8ul8y+CoquwMUbhEJZbc2QqCyxdP48Nfww3ovPBM b0Sk+r6ccXiqDLKh/Prf90GCWj7blyE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725261333; a=rsa-sha256; cv=none; b=lG4Uue7mOgZ+yE+kS9wiu8sXoZUicPRMmX8BVPsMiiuzPooih4PNCa1LQdx7yDdQx38RuO dzXN+DCcypm93t+qjnqg9JxY2ySK0EprMbBLqkHQqsnyBGQFzz6iYUTx0BISf/JPHHZYr8 w/by0XJZdO1B7oVi3KQ+npS308J5/nw= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=WbsWZzPz; spf=pass (imf23.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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 dfw.source.kernel.org (Postfix) with ESMTP id 18A7F5C574C; Mon, 2 Sep 2024 07:17:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 422A2C4CEC8; Mon, 2 Sep 2024 07:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725261424; bh=sa8ddOMDXRaYhp/IOg2wSEnMgXawFHsto5brOpBu4jE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbsWZzPzOYnq9VACFjLbHT0QtTboQMrs9Cl5BnEg42AvkulcCszPJZC4ZgWJ7VBIs aa6jHlKKy7UdoTM3zYo5H5sY1gxJVq8u6gEGeIGVjHyKyvlMx7Jw+fs2WXoRrqOR6k B3lHLvwe6ydPue5clUvlCNMVXV1PbfHaTfNFXvS5C78imrXR4D+wTnakGT8ZwdzMak H1fg402rc99rP4R//IJ5X02R3KMzo1XrNoEQMHSIEhTNiwT7e4352mPk+9CfuKWovi EMzxRlUou3vQ/ZS/xQiscEZrpsDV8+bThb50Mn1FvN2/rNaA8KQJEsw34L71nnOBAY L0XGUwN8m4lWw== 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 09/21] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Mon, 2 Sep 2024 15:21:20 +0800 Message-ID: <20240902072136.578720-10-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-Rspamd-Queue-Id: 436E4140011 X-Stat-Signature: qfs6ihms7dbpewr8jqzfem3j6qct195y X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725261425-81404 X-HE-Meta: U2FsdGVkX1/4prjMmxVyHxiRK30YUz7YC/rEGTutmyqGsN/LMQDh0ZSq8VoVgRIUEqCZNF5T1RsxKTsnjFHCPGpbkG+OEXIZ7gwbRI5zzxISSMri3c7IRVkQs4s44K3HAK1HzfJPYh53KxDQVGhKOQyd/+YyuPz3eJ4a0LORksogp35CgidXfNLtDQ8YnGa0CykhsAG5gJmSp1njWPxtum4ueu/qo9SNU7E/vnC8lmb8XSUJuLNIqXP8LypV1QZ44xZCD2P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SNwHkWklNW+1SON6yJl/kkCtNfHvlESNK279n39c 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> Rename obj_to_page() to obj_to_zpdesc() and also convert it and its user zs_free() to use zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 01c5be6f4c96..90d93cdc5df6 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -808,9 +808,9 @@ static void obj_to_location(unsigned long obj, struct zpdesc **zpdesc, *obj_idx = (obj & OBJ_INDEX_MASK); } -static void obj_to_page(unsigned long obj, struct page **page) +static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) { - *page = pfn_to_page(obj >> OBJ_INDEX_BITS); + *zpdesc = pfn_zpdesc(obj >> OBJ_INDEX_BITS); } /** @@ -1483,7 +1483,7 @@ static void obj_free(int class_size, unsigned long obj) void zs_free(struct zs_pool *pool, unsigned long handle) { struct zspage *zspage; - struct page *f_page; + struct zpdesc *f_zpdesc; unsigned long obj; struct size_class *class; int fullness; @@ -1497,8 +1497,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle) */ read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); - obj_to_page(obj, &f_page); - zspage = get_zspage(f_page); + obj_to_zpdesc(obj, &f_zpdesc); + zspage = get_zspage(zpdesc_page(f_zpdesc)); class = zspage_class(pool, zspage); spin_lock(&class->lock); read_unlock(&pool->migrate_lock);