From patchwork Tue Aug 13 08:45:55 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: 13761558 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 79417C52D7B for ; Tue, 13 Aug 2024 08:41:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 03BFB6B00AB; Tue, 13 Aug 2024 04:41:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F041C6B00AD; Tue, 13 Aug 2024 04:41:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D56016B00AC; Tue, 13 Aug 2024 04:41:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B0E4E6B00AA for ; Tue, 13 Aug 2024 04:41:44 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 39958140693 for ; Tue, 13 Aug 2024 08:41:44 +0000 (UTC) X-FDA: 82446578928.01.9DC456F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 9FB79C000D for ; Tue, 13 Aug 2024 08:41:42 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Zn4AO2PP; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723538424; 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=8ctuRfyWnTA65JNahQV20ejpSulzJ95NrLnSE4x0zYg=; b=k1wGKub5ZMdiaw1+4j5XPewvz/cnYnJ8ycmyLBCX0D/0AUMAOAGwCrrbJ3S24e34KSUd2w YOWSSkckhQJYj4EltXztNzkPWbm+lec+PCU73Vv60gxWdhhZLIqtHaXFhf6jtWSxhPMPqI EWXohoyySF+9KszPbQzCwIbNhe/MzRQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723538424; a=rsa-sha256; cv=none; b=DTxTc383j4+dLNxFSlFNSDGQkyLIO9gZYs+tOF63U2TVSuyzJ6/ylWm76obzoDw78hqCfM ddbsSWzzLWrJq7pF3TbqKxS00WQ9EkoTIuAYWAsgoSqPGysyQ6ELtAy49v6pBsUXEO6I9e 54gn5EApuLLm6Ka87swFC1LhwjpbVYc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Zn4AO2PP; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DA2B7615AA; Tue, 13 Aug 2024 08:41:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6896CC4AF0B; Tue, 13 Aug 2024 08:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723538501; bh=TLwbltxTVpT2lgiPJc6Jxl8phogKw6tUJfKuP0Et5M4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zn4AO2PPsEJcQ4S/HgpTW9guymMeO2zo3b9e8FX/6yLaPpDw0yvUCSZEF1oFBDj2V ee4zE0Yh6pulxHPa96xkoQA8A38ttfDQppDSn3RBMZez9+OUE2NO1KlMRwQjgRWSfC MW25K0Kbmj/zZZO12e6xpBLe8W8zJA6dBZvuw6mmzVnXgdXxtQ+7LXnPPqAJFP9z8G IaZuTq09bkCVYWjqEmZZLFL5NbsJJEnOzGWh4c7AFa6Af5SoD6Yego+/BzJ2D0mO8w 6j7jE3ZKKt/fXyxXpy/uhyjt47zFMj3n8FY+7qL5SI8jqBzoxQRKYHJ8QAxwY7xUe6 LnSzxgNYWLTpg== 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 v6 09/21] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Tue, 13 Aug 2024 16:45:55 +0800 Message-ID: <20240813084611.4122571-10-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240813084611.4122571-1-alexs@kernel.org> References: <20240813084611.4122571-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9FB79C000D X-Stat-Signature: jzi194fdyzhrxqintujuchgcbexya34f X-Rspam-User: X-HE-Tag: 1723538502-164609 X-HE-Meta: U2FsdGVkX19EXTAKJXWg7OqDH1MxL6hTSvgOzrNbLUIsMyTTslYQ4s+UUGXsqP3I4BJfC+q6CukHBhh0lodf3+0DzsmPUFPjghd3CVAevgB6SLrmxBl6LvcPdjm9p3U6ZLmX2BC0emTb/nmFVXy+rrLnT/n3pSc7jUR3FwgHVYXxSlVhWjtIuS+XfobazY5+xpUmPmqafANfnkE3yd4rQBJI9PUDNA4/4eB20+q/FbSxxgJUm6exwKdcrsFZPb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C5QLLiUkSNhSibOWxT1kb2J7GKDuaLv1YpmcBX6 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 b07c14552276..cb90defd3c0a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -814,9 +814,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); } /** @@ -1490,7 +1490,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; @@ -1504,8 +1504,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);