From patchwork Mon Jul 8 06:33:30 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: 13726197 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 D09C1C3271E for ; Mon, 8 Jul 2024 06:29:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 686376B00A6; Mon, 8 Jul 2024 02:29:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60CBB6B00A7; Mon, 8 Jul 2024 02:29:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AD5A6B00A8; Mon, 8 Jul 2024 02:29:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 26CE36B00A6 for ; Mon, 8 Jul 2024 02:29:18 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D5A3AC10EA for ; Mon, 8 Jul 2024 06:29:17 +0000 (UTC) X-FDA: 82315608354.09.4430BEE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 2DD52100017 for ; Mon, 8 Jul 2024 06:29:15 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bj79AIzd; spf=pass (imf14.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=1720420128; 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=phQ8tz7yXBkNlTZGC9m4+DenCUupj5avJ6HqjXj/9bQ=; b=MKHRPbdgYyN16v2goG7UhSEOXpc1rCTG/Y9hdh/jFA6BUxLBO0B3IHoCo31/8BmYhPjBxm 509u+DeyVvGERvn/ZuWsVARzesI/6lWVxzWwN9rmJRxwCHOrR7b9PIz1uD6N4pBKolXlVx O98YpPsj4JvqHOcFJ4qw0URnasgOKWE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720420128; a=rsa-sha256; cv=none; b=YKZKcIDtsbrhYTpSxnJU3whD7E7ekkMHYmu3cvZj/diLJ0hg+0KbC6vKXK1jBKIlEdb3vL OIxthULVrw839OOBzSUx7+qIkLDVD+Y5C5gwm3POq03lI+wKQRbM187D9VRwJvp/oSKCBX X1W6rDVJW1rJ1qDK89u8l7fsyFngVjU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bj79AIzd; spf=pass (imf14.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6553E60AEA; Mon, 8 Jul 2024 06:29:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23D9DC116B1; Mon, 8 Jul 2024 06:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720420155; bh=+/6M40wiCxzKTfpFU8y734xJ8A1hop+0lKYvujpVbRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bj79AIzd5Z96XkWJssrQs+SgHiVAhDvkvP7hybFxHBlia0CX41bCz2dfAe1FEvavy ucW6BDXw013iA/lgkUiD5DgFHRea6EFDOX9+8HM2uM9TPPJNuJ1VH1g5XqEj6bfFTw 9mHe15jm4warZWmrhLIn6yMxXXdVaTxcTksSp1MlPWPMoBlnxjIEXt48H/+sYbZVF7 GCslgTjIOKhj83dyvlBFsD3uBjPddg4JuIZZAjASa4DLkpp5j746AIFjUg7QXG474a 9/l1EE3zbQ1sWJVejTgqd9VqAr9xEOKn1aYKN6KBo+pSfT2RLMFmBjoVb9jsRauqSC rznbzr55ZCVBg== 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 v3 09/20] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Mon, 8 Jul 2024 14:33:30 +0800 Message-ID: <20240708063344.1096626-10-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240708063344.1096626-1-alexs@kernel.org> References: <20240708063344.1096626-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2DD52100017 X-Stat-Signature: 7xuwhrtp64zhxzqshbhen75fypn1zzk6 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720420155-620377 X-HE-Meta: U2FsdGVkX1/zM3aE2W4LT/WNcM1hF5C5gb7fBG1jUdy1ZaiZh1181uos5zD7PRkj3QS9USrjK0qHgADQWHE5cY/2VTGhv8+EVGuCILlej/snUgwXxA8mFM4tUlgOVM9/vzjCUqf2KzPbSB7yqi+/uNWi/TnuH22bAmo5DyUGkHrePEmUqpD+WyATmyNY1yPFqiQtgYB9STaGuv9oC6JU4wsOz1lLWPb5CLOA24SHkq8+k5VtonNibnSNr1eZEbOW3FKFS+D1J+W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l4AsQGCJamZSKxLK9pK6zZUWOxb+Eb8CAzVWPIuh1m/ 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 (Tencent) --- 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);