From patchwork Mon Jul 29 11:25:21 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: 13744732 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 2111DC3DA61 for ; Mon, 29 Jul 2024 11:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 740C56B00A1; Mon, 29 Jul 2024 07:20:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54C096B00A3; Mon, 29 Jul 2024 07:20:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3763F6B00A4; Mon, 29 Jul 2024 07:20:50 -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 140C36B00A1 for ; Mon, 29 Jul 2024 07:20:50 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C1EFD8019D for ; Mon, 29 Jul 2024 11:20:49 +0000 (UTC) X-FDA: 82392547818.06.9680D5C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id 3234A1C0003 for ; Mon, 29 Jul 2024 11:20:48 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=T0HH8kYx; spf=pass (imf20.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=1722252006; 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=TJqG5dwhfFg0PHzR6PQawnyu+ajyYcBzzmI1swN5VQM=; b=4lhidBg3QDI13L7iaN/62kRCc/G9eI0+sejFzMgmNEtS04OxHC4E8WGY/XHLIwXqbeZ6SX Iz+zZ9IfRMjbscFpfnM6FLIj4CfkWdewlFx7Q3wHLwTaAo1Ohk/YI4YzGbaMSCOlPsPKHi 16ko8rQ01O5JjDpS+Wyd0IxK1jeYkYI= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=T0HH8kYx; spf=pass (imf20.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722252006; a=rsa-sha256; cv=none; b=WAiKFkPp4kzrk5Sz9Ocoz5SwL/kt9CQJm25YgUfz/ZiusPTYYXaKJj45MG7vUPuY2P+GQH IF+4cVFmn3fWy0K2nHjw6Ph7+SvK9eubMMxbY+HvRv/LuwsYCmZPrHVA3CGhQ3UZna6u2a h2pn3LFDHCYFQYH8rpNnQT3Aqck3w+U= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6DEAC613EF; Mon, 29 Jul 2024 11:20:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60074C32786; Mon, 29 Jul 2024 11:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722252047; bh=cpsRKinL3S7LbxZnzQMdHFXcR2a2bxLsePv8cUuJa+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0HH8kYxUU1m2iRXQy2rq8UBV0w9GOrcvJ5BKUKIZP0MxXQhIiJHVXkOYVVvUrFc/ rbr+b4ZBiHZ0MUo9TvktNqnYHiM4n+NSgjKL43RRGvYjmPnPKvw+jCbLo9v9YaBpOV F8ve7JyaLosgbP5LMe+oLr2On8GDoBALuQBVqDlOiAmOJRfKpSmn7ZybSNJ+bx+ffS kGkruVAKs3HzjR0cHAJy5RkX9mjF8+0IztbMD5XpjxbMs7PiqUDSQvpqpyofs8/FWt clA7JVTFSXxI9MlNfs/KV9XHHCns4sVh32aFpY9QJcsQ2236XureRRXkHCFAjdfjc5 Mr+RgjTe17w4w== 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 09/22] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Mon, 29 Jul 2024 19:25:21 +0800 Message-ID: <20240729112534.3416707-10-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: jhqqdhzwywnwokjq6wttd6n4drc83p1w X-Rspam-User: X-Rspamd-Queue-Id: 3234A1C0003 X-Rspamd-Server: rspam02 X-HE-Tag: 1722252048-475545 X-HE-Meta: U2FsdGVkX1+7A0mQxaaBZS3kC69pg1XyWuia1MAlX3vlqQ1RQD+ZkPuEO6PPrEGiEWPnEYzq4P+s0xvO7UsTRePeKtq4J+8iMOVKdlonb2KEIslayHxzhmMk5j7Bj8vjgO6hKHIkER1SP5LBqEtlNfhlKLeOROaYESZWQLzFOun/Q1buwaGOSTPnlFDVGOt1MhQv5jj1PSFmsAi8WOS9smiW1N5nOweL4BTpG9FBPKojJQ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Xa2lILdJpN3qK54Ez7kHBfi2Xe+fR0cyX/gzeHZzn6qbpZS0tHuyZq2dmpYSKEIx7u3NnCR06Gqry4 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 d3558f3f8bc3..7aa4a4acaec9 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -820,9 +820,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); } /** @@ -1496,7 +1496,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; @@ -1510,8 +1510,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);