From patchwork Wed Jul 3 04:06:09 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: 13721228 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 6F0C3C2BD09 for ; Wed, 3 Jul 2024 04:02:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 014EF6B00B3; Wed, 3 Jul 2024 00:02:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDEC56B00B4; Wed, 3 Jul 2024 00:02:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D345C6B00B5; Wed, 3 Jul 2024 00:02:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B0C906B00B3 for ; Wed, 3 Jul 2024 00:02:27 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7308B40786 for ; Wed, 3 Jul 2024 04:02:27 +0000 (UTC) X-FDA: 82297094334.13.2FB2B0A Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf02.hostedemail.com (Postfix) with ESMTP id 79DA180003 for ; Wed, 3 Jul 2024 04:02:25 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Rxj4KWb+; spf=pass (imf02.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=1719979322; 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=6sIt+/gQb+mmHbUvaMTN2rMqRFssnW21+1PAy7MZPc4=; b=aSDss88CUZ9hSJVAqbC51hZzksN4hR73cSIoez23kFd7bgFHcL29oHgmJTZs7REfvHl1B9 3SNqTv9eGPboP/fBw346wnGXmtZtbZmnU0KJXP7pQOvHbngGqPetj4TnInhPXzg8VX5WVK EwRLT3IqhFGsDOJzUai6FtWDBiZgA9w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719979322; a=rsa-sha256; cv=none; b=GRfezggCGXDQ5+CoCeY5xRETm8j1rApu85WCFIryljIQhZT/6Z2evAFAsYMluu7SVzi2Km oUl2brXoY6Wv1b5VAvDoRAssKxosfnbU4rXiOyXTID+FY0QI6iHMrwO6GYut06gaT3DDWM BjViw4v/WEeF+gthtZsbBxa0vwKKaD0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Rxj4KWb+; spf=pass (imf02.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id AC6E4CE0E1E; Wed, 3 Jul 2024 04:02:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCA06C4AF0C; Wed, 3 Jul 2024 04:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719979342; bh=hU+tJyMJYXqvt89j51XXi7aJ8UUcH7P41TCm8J5zHmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rxj4KWb+WvTzcDWLevWOhyIZvPre2S3FEfiFSoQHVdaD48MPqIaESXA0lOeqDWz4J +PV3qdO7ClN5HuEXB8ZUTc93SoSHRCXfeyZI6fUCocUSJvT7GQ3gYuhhwAhBmiA2gQ 7Yd7yqxS9s9YMDPR2GjZ+8cb7cxFRTqV08nofEfWWqVvquRaIH5UowQJOAm9rb6Gk6 EqDDetEeLI9t2PnL67Cb00PJ3IQcUEQU3tIyO/IsiBlD8O1p6pNaYiknY4a9ISb+wO E+VQvCq3i2xi4qwqy6BJzM1lJTJPnVc4iWDAyklxFyGuvDzcv8yzDdWvCLl69l39Ja +6L9lNmpQ87Pg== 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 19/20] mm/zsmalloc: introduce __zpdesc_clear_zsmalloc Date: Wed, 3 Jul 2024 12:06:09 +0800 Message-ID: <20240703040613.681396-20-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: rspam04 X-Rspamd-Queue-Id: 79DA180003 X-Stat-Signature: sn77dfygiousu5puzw9q5h9bpto5mnxs X-HE-Tag: 1719979345-807486 X-HE-Meta: U2FsdGVkX19SFV6Lc8CH1DM66QcsMM2yaenpzAVTn/LZjc62y1/4hF+z3QtTMarK2XpAu+hBPzoJjLw1NL3lig/N0qZwqHjs1GgKYtO4ygaCY0BCyI7RcGAen0IbSRoAt3R6RWJErVc3ElrgUSZ9ugOlLZfrGmEeJrWx5Dny2Uq/vfIY/ZTuvypTnrvWOdBW+E5cbtnBnEKhekU/rhq7Nnc8y/+Ie0roWtDcOqRarJwFbhtc/EsLp5zsUKOn3hxojVQH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zwY 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 Add a helper __zpdesc_clear_zsmalloc() for __ClearPageZsmalloc(), and use it in callers to make code clear. Signed-off-by: Alex Shi --- 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 4780d7015267..e6a71c7a3254 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -116,6 +116,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 08ab22f0ab7f..9e87a17ed802 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);