From patchwork Mon May 8 07:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13234118 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 1F2FAC7EE2A for ; Mon, 8 May 2023 06:54:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 690456B0078; Mon, 8 May 2023 02:54:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6191D900002; Mon, 8 May 2023 02:54:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4952F6B0080; Mon, 8 May 2023 02:54:54 -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 362546B0078 for ; Mon, 8 May 2023 02:54:54 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F30841C7398 for ; Mon, 8 May 2023 06:54:53 +0000 (UTC) X-FDA: 80766175308.26.D89E6FE Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf29.hostedemail.com (Postfix) with ESMTP id 54A1012000C for ; Mon, 8 May 2023 06:54:50 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1683528892; 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=oP7DGThGpZGDNBqu8X6jnO1rCC4w3UXrojF/HjOHYmU=; b=LvIkpjse6xbPtoYV5VcT72HQnVUaW9u+knAncImMjeSYLuA86blEq4lnmqGcfrVyyNmHG9 3c0YuSg6l8/RC7bNA9+4geeHzi9sokU25Snvhw+4TTaMVGQNbZakshC4K+TjhILRJy5Lng K7dNrXYbHM3TGsMYplzSWaeAe/KVfbY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1683528892; a=rsa-sha256; cv=none; b=VG8np2n8mgYAfmkek2KWnfJRfjwNHIaXJrVYIarEdLgZ9BwoRbb+DK7JrtzDzbr47v7JU8 MnqrOvAeFCl9rMEMYHc3xmR+EDhP5GhYVcUygdzL5bs57smdq9HtS5i6OlNhW7oPl6FZdD Pz1BerDKoIqmP+5pQama7BAA5DrNzCA= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QFBkl1tsTz18LDq; Mon, 8 May 2023 14:50:39 +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; Mon, 8 May 2023 14:54:46 +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 02/12] mm: page_alloc: move init_on_alloc/free() into mm_init.c Date: Mon, 8 May 2023 15:11:50 +0800 Message-ID: <20230508071200.123962-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230508071200.123962-1-wangkefeng.wang@huawei.com> References: <20230508071200.123962-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Stat-Signature: m5pxjo5wjkwgs7854zdbwgndidtgoryd X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 54A1012000C X-Rspam-User: X-HE-Tag: 1683528890-280143 X-HE-Meta: U2FsdGVkX19gzUAZamzfQlVmsmtmPhuzjuVB+afrUI3AYbzE7L8KsVLLHZbOqYbEbkON1mdD07P+Zg+PonMv+7CppyQSg2pQ1Yh59lPNXoJwY9hwbgL4nH0DP1COxeEprVHamxwXtXA7Mx3ys9CT18GE+yFKs19uqptD25VWF08ceP4DgzPmzf8CPPWgxpkbYXgQ4GSdJt+8/V1mWDmf/9ZoXtZvvWOEXLZA1dwxNfUnfEAuwXjtUs+1OzPVhJf686rxr4RSkxY4zX5nB1St422doMSbvHx5fqvhrjcqj4J2TfyyCJOCRhGolUerxzXTTZjIxoHDM5iLMhaACAPQzCU7pnzg+1FgKHzi+bpq8QUw+asURdIcs3d9+lEV10tz5cw5D/vw3FvLIeASZ3NpxJ2Gtg3FQHcmSo0rb1MnRypEZiMzBlwg+0c1CALXpMy4iNDA4D7c1fGn9DHbkw8OfiJAV6P8Vdd1IpbykoZ9FicdC9oHFKP8qHDYQCm4QcwInVef3Qwpakvn6GOpJnvq96WEt/MvkhLT1+x+TfTy6NJjZyhaQryp3W1st0uRc5uAV36x1XguoUl2aQYorj5kZ0pXlPu5ddbqR2Ry2qUPiLG7+AVNIrzu2MB9u5uUU8GQClsBR4kXYPGvvDpzfLegOmz8AvnfeUYuJU+IRAB0B7FigAeG0HBYFptl1JM9Tv7Tb3wDqySY32Bb5Wj7XZ7eFoyOpqpHOuw3SEzskOaeF2vRf6dwp7NEqci2RhlkjBRHo5STyd6h1gZZBq06TuBiXGI/0SiNQcHVGmL3YEPHXU9wfM9QtiC7FsddVArt1d6EHTaed9Gv/yubxARvDYJxuVz3diBWl08JzLrNQ44qpl8uwpMrwJjKkhT3Sa7dHIxPociJZ1fcWLesno5cWTPmPs39VOAhem5M28xNVQRSxjHAyTGG8ruImGjsJF5nlBVD6W1oS1U3S1lXMSjWFNw xwcTTMy/ ylgtYOgN6Ho3/N6sW2DWrJqBZJDiK/2dA8s22hhAN5TM+Y2ho8SOV7uszTZBzI1y4oygpu4LcYcACJJ5riiBGteGj3HGS3zRb9rLkT1jPzcyYjOmvdRqqsh/0bCf+2Agqj68UhWeOa2wXggS/rqDE+NCcAS3NtKtNF67AaWdPCg4jDw2PqBo0r9jqruS3PeYELRh4 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: Since commit f2fc4b44ec2b ("mm: move init_mem_debugging_and_hardening() to mm/mm_init.c"), the init_on_alloc() and init_on_free() define is better to move there too. Signed-off-by: Kefeng Wang Reviewed-by: Mike Rapoport (IBM) --- mm/mm_init.c | 6 ++++++ mm/page_alloc.c | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index da162b7a044c..15201887f8e0 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2543,6 +2543,12 @@ void __init memblock_free_pages(struct page *page, unsigned long pfn, __free_pages_core(page, order); } +DEFINE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_ALLOC_DEFAULT_ON, init_on_alloc); +EXPORT_SYMBOL(init_on_alloc); + +DEFINE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_FREE_DEFAULT_ON, init_on_free); +EXPORT_SYMBOL(init_on_free); + static bool _init_on_alloc_enabled_early __read_mostly = IS_ENABLED(CONFIG_INIT_ON_ALLOC_DEFAULT_ON); static int __init early_init_on_alloc(char *buf) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d1086aeca8f2..4f094ba7c8fb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -233,11 +233,6 @@ unsigned long totalcma_pages __read_mostly; int percpu_pagelist_high_fraction; gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; -DEFINE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_ALLOC_DEFAULT_ON, init_on_alloc); -EXPORT_SYMBOL(init_on_alloc); - -DEFINE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_FREE_DEFAULT_ON, init_on_free); -EXPORT_SYMBOL(init_on_free); /* * A cached value of the page's pageblock's migratetype, used when the page is