From patchwork Wed Jul 3 04:05:59 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: 13721079 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 C8962C2BD09 for ; Wed, 3 Jul 2024 04:01:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51E0D6B009D; Wed, 3 Jul 2024 00:01:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A6FE6B009F; Wed, 3 Jul 2024 00:01:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F9FC6B00A0; Wed, 3 Jul 2024 00:01:49 -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 0BF226B009D for ; Wed, 3 Jul 2024 00:01:49 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8E0B6A2775 for ; Wed, 3 Jul 2024 04:01:48 +0000 (UTC) X-FDA: 82297092696.01.02C7666 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf13.hostedemail.com (Postfix) with ESMTP id 9248520023 for ; Wed, 3 Jul 2024 04:01:46 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="h/vn2l9o"; spf=pass (imf13.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1719979295; 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=j+UEVMhUfWy9YctgTHhj9NC3X2Q6L/wKpAT6WsJcMvxAdYEbBTLhWsvDqQvpzyZjhV+utS 5DDiQJiaF2LcPMAr5RjvgXKm5JE8bFZz2TBZjsgKRybEkpfCK9opmgTGkFoezIbpzK+9BX xp3HgqkZDMOcLC2mQpXOSTM5tccyENk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="h/vn2l9o"; spf=pass (imf13.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1719979295; a=rsa-sha256; cv=none; b=lF1hpRs5Sbx0SAQlRHwnG2NLqbjvhiZEWkTP41rgAQxyVytFVTCJMeCuPmtW6QJHwVRC4w MCvHFX6Z6bC+v9kx9xeQSFERvfHMCrVb/tfc9fhScFmMIHIDJovCg5gntIbOSX/PzZbxI3 OMkN9UE6XNZnEz8XKTz/8e7YH+j3jaA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B0BD5CE289F; Wed, 3 Jul 2024 04:01:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9464C4AF0E; Wed, 3 Jul 2024 04:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979303; bh=cpsRKinL3S7LbxZnzQMdHFXcR2a2bxLsePv8cUuJa+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/vn2l9o3YSdVOjafhW6qL2RUpxiwj6dLECE60UFuR7t8SZfG4edNba8A/qzaWYOu FtDjnMdg7TiMbLrqMf4E5P4XVWzIrH4IQ2A8brhdPHmObwWoKyZSngO9YkKZdafPBC VcUl09u2ChPvdiYH8WCn/LocRf/ff/wUNAE3SdawSUx+9HQEWHIUOw8LeF65Z15POI 1EmLkS2S5y55raDFiV3ohsvIKoFNH3jumJfY+f7TobhdeFJyrjTqOoF5oH6ZlIsSTt 3Jq7Xy/bhl2AnZ8am4wTsCkWnlp8TBUcPD/dlOh2lY3B5IaxKoCmRyBdS0hpGQz5od KnkYo94ZbqgjA== 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 09/20] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Wed, 3 Jul 2024 12:05:59 +0800 Message-ID: <20240703040613.681396-10-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-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 9248520023 X-Stat-Signature: iwk8rc6o874ycjqdfwnrbsmea45riskw X-HE-Tag: 1719979306-530432 X-HE-Meta: U2FsdGVkX18qxKAxskZWzh8P0uAxGZCr2Rcee7S4HDm4KaWRYI4Qp6pJPXW/Z9509Hbmpf1evO6/V5DZLp4vv0hpQf/nAPAavY6hz1pksNxtaXbRAo8Kc/kiiCg6addFCyMbV2oQ0w6XKKCY5BvXLQHvzBEiX57rwbfIIDVPnIcXtKi2BOdZyCBpfnByRrLcC5ESkWOzcJiuN3Uy4v/8wf0u0TnNHZGQcJGvH1KMDUAVexNGwZfZqJf0r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X96OPz686kFzBP+8UQ== 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);