From patchwork Tue May 16 06:38:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13242573 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 DA2C3C7EE2D for ; Tue, 16 May 2023 06:21:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C105900006; Tue, 16 May 2023 02:21:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54A5A900002; Tue, 16 May 2023 02:21:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E9A2900004; Tue, 16 May 2023 02:21:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2C0EB900003 for ; Tue, 16 May 2023 02:21:37 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0490DC1320 for ; Tue, 16 May 2023 06:21:36 +0000 (UTC) X-FDA: 80795121834.15.1C4BDE5 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id 42C244000B for ; Tue, 16 May 2023 06:21:33 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684218095; 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=U+YxG+zKwUi/FiijdHXbxPyp+z4iMyYwOoeCyElx+aI=; b=KevS5a1J4B0QpaOafTf4/d8IAEXBvZuMH0/gsyKqQKUvWMmRuM+l4WccM7MaRQOzeps1Ds eHIUlarPMcPtvO9XrMaWgnGxmjoFtWqecAANIZGTuR8ghCl8m39irT4XuXXKf1L0EGvfgV E9TZXwvumuGh1irbd6YgXVwTjkzkmss= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684218095; a=rsa-sha256; cv=none; b=ljBs2k96XjYrT8QkWf8no7ohpZDseTmzX+A+rCrnQlxwdnl0Y7IR4mg3/K656Ja9YZlWfA 7w/YK9PitnsHyiYwX5uc06C8CTxtbOZKcbG5IWEACtD60YuVifL2J4VtA9iuYX0FIRY37h OwtHb3s48e++0Jq8wzGNOO6RZJ3ax+8= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QL5g80Md8zsSFG; Tue, 16 May 2023 14:19:32 +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:30 +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 02/13] mm: page_alloc: move init_on_alloc/free() into mm_init.c Date: Tue, 16 May 2023 14:38:10 +0800 Message-ID: <20230516063821.121844-3-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-Stat-Signature: nyczebzkbiph1jsckz9nmhcoecugcu73 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 42C244000B X-Rspam-User: X-HE-Tag: 1684218093-302838 X-HE-Meta: U2FsdGVkX1+uORnulK0fXT+t6KnM77MDbyMgWcY9xOpTkg9XZbfNLSpgyyoUT5iRiyCCMmAOupNoDdhhV+nb/jriw8mlRB+AJijwU80jrCUGGEgrx+1tKBSD0cuaWr+QK//uSy1wAqJEqGcyaKrLtLnNQpJOt5yJIYRH2UHIx6zmJ0cwOE5L6RMX0r7Hq4IHGOKcYfui++da5ZcoqHi1AvdUmi238DWUuT9ayUVm/1foU5fcDZcGvzXf09P31JhR+yZbPNVp59Xrkavn8u3a1BrxOXp2ys4O2jFFqd5hdwRJ9HQEz3hP3SSIOAdXwXXgaoCj4bnhDG62ht5qWQNwIPl+DJrk5nEMr+oXbxmUYVrB6ttshuYQQGY1UvPW5e2rPmFZKTxZhGJyBobMa2mdFUF1N4i7e3pggHfzD0u3Jpl+/IOuPHY5a+rOay34ZLbL4kUPMcf3zuwpoUKl0vTg1XQxLiZd8PfUJcuU15MUzePjePRMzptblNfHDxgmB/RizDvJjumN9KSjbLV6gH1AeDXZJY8bvR2+wvKFIakwlHgD2VwihTSBf2KCLPm3XO8xI8D7QuKi3gk8kdyLxTCjq3T41z9xyruIhKaQlgVA/b4Cv43hBVGoNWNhJx6N2/bR4pdMy5H695wXrYQN/KaxYXo4UaPymMtepf2HKUrrbU5pmReeyYQX5vGaE5VynuZxUe4dRURR69Zi2QIipZSKFXbC0Wa6XeoCfawgDWYdo1F5aTAHhEy2aA6V+zTaF2ue/gUWmdosAskiOR1xC1Hd5CVMPwx2dbt+kq3H3CXcAWl6gr3NuM6uOvlG0acj+esLRn28J/6B3fYUuufhpBblDgitnZ7kPoecsheY8gGiJrXUb7XcjvUH//ks6B884b58U7FGjhmFs2fyuwYj4a7BG5/IJgpk/LXrmNyrUbgzx4Q5+rj7NXcRqN1NQU7CgvGuqdFYKELPqhBuD5YXx5W DFO06PzT LRvaypiQAsRhffljldoHXm9dk6c1i/malgWfd5jd0dRh5/nubY3GZRR36DLBf2ienYnqciOhWWIZm6ZXICfkM3V/9GBXjcAnbxhV9XHdkYMJb/eoZ7mA0QcA7RojiqL/CxY1nxZ0V8qLQqqJDOjnaKOL34RcWuxwo+1+LbFEDxocgXQHaG0sauT691UFmz1Cln3eZEQSoS8+jh1fLSbfhORjdEEv+hwO8DeGLoVF8RHz+hfeJJ64V84IBTFljGHcgFk95 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. Reviewed-by: Mike Rapoport (IBM) Signed-off-by: Kefeng Wang --- 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 4b4188cff820..bc69a0474069 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