From patchwork Tue May 16 06:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13242585 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 A077CC7EE24 for ; Tue, 16 May 2023 06:21:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F152728000B; Tue, 16 May 2023 02:21:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D872D280008; Tue, 16 May 2023 02:21:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B655A28000B; Tue, 16 May 2023 02:21:43 -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 A0D84280008 for ; Tue, 16 May 2023 02:21:43 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7155581439 for ; Tue, 16 May 2023 06:21:43 +0000 (UTC) X-FDA: 80795122086.17.1FE01CA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf23.hostedemail.com (Postfix) with ESMTP id 223AA140017 for ; Tue, 16 May 2023 06:21:40 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684218101; a=rsa-sha256; cv=none; b=siToGsccMEwxweRAgzFZf+YG0sFPMGoM/ypEbKRzvMip5xN51Yl88LytQ4hYVTDn9TB+np MZDEENyTjdDevg7CGsCjZAAfXqUeVZ/NeNQztt7sSwWjU4hMRH7F7ik/C6n/ZB9nAMSbAP goEyEmTdw1Ja5cFXtNyQhB+2zv27TMM= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684218101; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4b99EODE3M968cRu0gr5EcqMioO2UY6+VKVSbMny83w=; b=ggMQjsFwYj/EzEgTkBtjeTU691DDWekKcYaQuooobus2QmyaKydstQgH8ONpGfeAsRJI+p oBxFPtlBKCNA4UjOKdqfU/SbBQwe3xp1sw4ClASwAy/SS/RTeDDIickz822XtRAjt0duM9 PqCD7wtANBvAw8WPauWi4vbyT8oUb6o= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QL5cb0cKzzqSMx; Tue, 16 May 2023 14:17:19 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 16 May 2023 14:21:37 +0800 From: Kefeng Wang To: Andrew Morton , Mike Rapoport , CC: David Hildenbrand , Oscar Salvador , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Luis Chamberlain , Kees Cook , Iurii Zaikin , , , , , Kefeng Wang Subject: [PATCH v2 13/13] mm: page_alloc: move is_check_pages_enabled() into page_alloc.c Date: Tue, 16 May 2023 14:38:21 +0800 Message-ID: <20230516063821.121844-14-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230516063821.121844-1-wangkefeng.wang@huawei.com> References: <20230516063821.121844-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: ufbuzfiikyupszqntoo4eiba6ystmrgu X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 223AA140017 X-HE-Tag: 1684218100-179392 X-HE-Meta: U2FsdGVkX1+ZdO6zm05iYOYCey0X5KwguptThfruhjfkRvQtVfHZVoXkWpxOSPF+qwnwfN2dWwca8YN0xJOLwPl8SGnnj3ONfQfRpfq0pJAavAdwinj/+n+/PppEjGDr86ZhnivF0AY+71yo3nIVhfjkqESYB0FJNzXnkJ7ZCzHRd6dzvvSNfE3CKAYe8ii/EDWMtXRcRmE8iHtot7GBjtm9lcdXuEOM/mDfAdNYN5e1hUfvwUfAzQST2ZDc1kwTIozOhG56CwakeQj9AM38R2iiN0ZpJ/+lwJlOXPA+PKt4RxIOSfgKEhuKRv4Y5oqYmtwd5vy5WVNVbxsajGl13hkS4xKBrGJa2M1pAPMDEKHXdgPDaR8wNmSg3OwwqoUC/Jz6av1gCgQ+NFe+ah0Ansi6f0xjl5s47dXamGxuwrVbcGejEsueeClUK41T4QNxqeyKjvLe7lfxJfzQg1TJLiePy/1jLxAFzCMrhrZETtks4lfVDU+K2LA0TTpvEqyzOAZPX1JljEABsU+5b6OiE8mYbeNSnOD1dynPrKsFxuw+MkMTOoeRl2j8u5lozQXITowayWbmWD3jRJ6ftJWx99MK1ayr1282rPS+JZ6qTV251xGQc2zZZOlkG+y0Y66eUN0PIeFU57WsW2vJvVO1RGc/O8SdEF7g+7ok9z63aRoHGTEcenP6dRal0gd2FtNBVFTVzv4H4jOc/pcrrHMMh/mMCbQF2WHqkvD95jlYyP7D+BlJ7vuXGeglKomld0/uB5Wtn5+UYElOXSQbNGKNNH3lP7hdcwbh6tzhYMFL695lrjvwC8LiGhGJUvG83fc9bMl9dFn5rJn8o6boq3WeHwRgdVgGKqGQ6hl1lECxaNY8qekco+Rn35XeZ0uK6Nkkg+DLdHN9Cdlz2XQAeHcsQJ2kWGEwIKrmRG6nFVnpUHbGmvUlZRt63+2aUai97/6AvKWBkh5ztPA5XsI2Oh6 u5JE2cf3 JcR57WMK5rFdkjBmWpxyqjr1Md8lXIdk9HNDZhxlZ2nAzKtM2bPos1cfwuJ/O/AtIPisCCIE5uSc1AID2yXPXtN1pkOkdFTEelVqWgk9Qx1VG+r3FiQfTpVvDLOWhd8YMHtpAPW5gx3brmnUtyq6WCajCsnP/Rbwu7ckr+3mjWkGCt8qaDbWl/P2TrJ3cav48gq/F4hc1oq/s9IE= 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: The is_check_pages_enabled() only used in page_alloc.c, move it into page_alloc.c, also use it in free_tail_page_prepare(). Signed-off-by: Kefeng Wang --- mm/internal.h | 5 ----- mm/page_alloc.c | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 5fdf930a87b5..bb6542279599 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -208,11 +208,6 @@ extern char * const zone_names[MAX_NR_ZONES]; /* perform sanity checks on struct pages being allocated or freed */ DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled); -static inline bool is_check_pages_enabled(void) -{ - return static_branch_unlikely(&check_pages_enabled); -} - extern int min_free_kbytes; void setup_per_zone_wmarks(void); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5e8680669388..1023f41de2fb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -983,6 +983,11 @@ static inline bool free_page_is_bad(struct page *page) return true; } +static inline bool is_check_pages_enabled(void) +{ + return static_branch_unlikely(&check_pages_enabled); +} + static int free_tail_page_prepare(struct page *head_page, struct page *page) { struct folio *folio = (struct folio *)head_page; @@ -994,7 +999,7 @@ static int free_tail_page_prepare(struct page *head_page, struct page *page) */ BUILD_BUG_ON((unsigned long)LIST_POISON1 & 1); - if (!static_branch_unlikely(&check_pages_enabled)) { + if (!is_check_pages_enabled()) { ret = 0; goto out; }