From patchwork Mon Jul 8 06:33:40 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: 13726207 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 49ECCC3DA42 for ; Mon, 8 Jul 2024 06:29:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC5F76B00BA; Mon, 8 Jul 2024 02:29:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C505A6B00BB; Mon, 8 Jul 2024 02:29:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACA3A6B00BC; Mon, 8 Jul 2024 02:29:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7ED4E6B00BA for ; Mon, 8 Jul 2024 02:29:57 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 29647C112C for ; Mon, 8 Jul 2024 06:29:57 +0000 (UTC) X-FDA: 82315610034.24.D01BEC7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 2EB3018001C for ; Mon, 8 Jul 2024 06:29:54 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UEHuelEs; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720420171; a=rsa-sha256; cv=none; b=4OOTRCd83sqyO4ep9h5amLT3cATIGafVQa2eq6wulIxOMXcoWjIP3S8Qv4IeuMPKqYd3/a dSvu9Zm8pWrplJ47MCimtjRMibY+sMU+efLDzJ7uEKM3KJfkzxMG4iIkqzf/ObK6FsR+Ey 569rdoM248YlRT2JUfZo6BrO3C/Cgos= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UEHuelEs; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1720420171; 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=MCgdwtxG6pnLG8vlAl+Sjd4oA+Jy4eLtS6tY87doaJg=; b=Q0CuKBAtJfxtWcwRxFS54Xkjj0WlQIAAVvmFg8s4rb8keyy1GkLaoujDDA72mcpoRR3Z5x npHj+ewXJ8pfcioaD6jfyga+tM4Q9FyIM/DFubcRkTBjCuMTV27kt2IJt48OL9gTbVgv2R qum75PtvD1M4fqBq1cXxPN+MtteG8kQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 9514BCE0A57; Mon, 8 Jul 2024 06:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F38EDC4AF0C; Mon, 8 Jul 2024 06:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720420191; bh=ld5kbfQznGqvmPXTBRxo+Gb6MyvpG3bwUJO7MMXVjOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UEHuelEsMNDLfNwnCkG7vPJYg9IVTB41xkci7s51NiPFoDJgxr1CUaRji/cVlqlNA vYdN8sXnViZNe3kSp0lsazF7+z8vLY4xWfdHqBLMGbC9cmI4uqUdMGYDo3TQBRCOan bINlkUPVQMuXuhIZ+Nmq7VOu7niPAgJ43p5dnvdDeoiuXWitnqDwZtAzukSp15x9ZK cWnFn0H6I99oVMAEI4Rc5Q3DCx5/rPZKTYyg1s6wKXmbZf96IvA0lyCPzp1T9ncpt5 0eZQBV6bEE+3Jborz9xlh5OA8pkf9vfMZbQks6eVJYhboRqe0qKCucYlARPqFpn8/R Gv4XpWfGxrqZQ== 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 19/20] mm/zsmalloc: introduce __zpdesc_clear_zsmalloc Date: Mon, 8 Jul 2024 14:33:40 +0800 Message-ID: <20240708063344.1096626-20-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-Server: rspam12 X-Rspamd-Queue-Id: 2EB3018001C X-Stat-Signature: 18yno8irn6k9uhkfmtanwm9mp83tmjco X-Rspam-User: X-HE-Tag: 1720420194-727428 X-HE-Meta: U2FsdGVkX19/w4PozThD8lCQOQ1y0YOY+OoYzZP/Z5UGxDU+GsdKqzx/xKH3F0vnAYD8AhnrFYNI/TJdHSjuESJCZiNxz6eKXYrfNAlItkEqI5tfza2M/m42XIiY4axwx7CFtt/Z2AuKKAlAA6Y7piKwAqv0j4qAD4+fX55VsmaOZ0h/1mH4g5C5D86SeuWJlMOCqnu2cVcp+9Sgz1bKE63lFBqWkvd1zJApVM9cwoszXaRGDGOoZgnNq1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1y5IyqCxbaE2 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: Alex Shi (Tencent) Add a helper __zpdesc_clear_zsmalloc() for __ClearPageZsmalloc(), and use it in callers to make code clear. Signed-off-by: Alex Shi (Tencent) --- mm/zpdesc.h | 5 +++++ mm/zsmalloc.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/zpdesc.h b/mm/zpdesc.h index 5db4fbe2d139..05def4d45265 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -119,6 +119,11 @@ static inline void __zpdesc_clear_movable(struct zpdesc *zpdesc) __ClearPageMovable(zpdesc_page(zpdesc)); } +static inline void __zpdesc_clear_zsmalloc(struct zpdesc *zpdesc) +{ + __ClearPageZsmalloc(zpdesc_page(zpdesc)); +} + static inline bool zpdesc_is_isolated(struct zpdesc *zpdesc) { return PageIsolated(zpdesc_page(zpdesc)); diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e1d3ad50538c..d88602fb0233 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -851,7 +851,7 @@ static void reset_zpdesc(struct zpdesc *zpdesc) zpdesc->zspage = NULL; zpdesc->next = NULL; reset_first_obj_offset(zpdesc); - __ClearPageZsmalloc(page); + __zpdesc_clear_zsmalloc(zpdesc); } static int trylock_zspage(struct zspage *zspage) @@ -1024,7 +1024,7 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, if (!zpdesc) { while (--i >= 0) { zpdesc_dec_zone_page_state(zpdescs[i]); - __ClearPageZsmalloc(zpdesc_page(zpdescs[i])); + __zpdesc_clear_zsmalloc(zpdescs[i]); free_zpdesc(zpdescs[i]); } cache_free_zspage(pool, zspage);