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: 94452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp213276vqo; Mon, 15 May 2023 23:28:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bMcNPkLQhNgVeKfiGdOgTo6WYy3Ogn2yNhQ5pAibTWypO0ItVMaBVGLin+71+jL/eqstH X-Received: by 2002:a17:902:b207:b0:1ad:e5e6:6c30 with SMTP id t7-20020a170902b20700b001ade5e66c30mr12490839plr.44.1684218483100; Mon, 15 May 2023 23:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684218483; cv=none; d=google.com; s=arc-20160816; b=agc7WbeQa51snuV5MC9NhgDYrcDHh8W132Sq/bZnvcOJQu9Xvf18aQCKf5Eb1hr2QN 2AIacSKZ6WkyCeyoFVBvO80IAYKn4o5UpzZBfmjMrtMzuK7faAN/6uWszuBFP8aLKpo+ +CH68Q8wOqz9U8wEvyARJBmjH9rOwtWPEoqm4rBSU1nqZY3oLhi+aOrPx2toasLB1z4Z 5dYPPigEP99ZipeZjyYwEmLOoCv1xkqSv41XnsaukBX6kUtx3U6iWI782NugfrghVT6Z /C0U5HccJN/AHzLVdBzVyFc1aj7x8IQpSs50DzXpyXdXHit1wJhqLFm9KWBFBbEsneKT dSlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=U+YxG+zKwUi/FiijdHXbxPyp+z4iMyYwOoeCyElx+aI=; b=s0gvwQg36HZ87dUTTekKlkSNNy4d8YdmiUbWE4/xpnvFd0khu4b3+WGXwp8FNajPD1 FKIa5H0RTJs2yxkrTNLi/wBmPr1I6OEdN4sTksrZJrbbFBttjzFaZVY2zYRbu8PjG5hn 3RD0eTth6igQZPlDCpqHRb0qQbkBxWQ7PCbBBL0lBZBZjuW3yxks3lXH6K3CiVt+WtL3 oudpeK5qtqHRR+3I2gaGn7rGCH46DhBX7osw0BYcKpBwwEP5sdy8uq3cjwXSNJNqf6Ry 1dlTtBBJElkcqss8ee3HG4nC2rNVel535SpPAwjPmV9X7acIpPyOZbQaSWSq9ZD6Orm9 zJEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij25-20020a170902ab5900b001a971d32b41si16508768plb.267.2023.05.15.23.27.51; Mon, 15 May 2023 23:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjEPGVi (ORCPT + 99 others); Tue, 16 May 2023 02:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjEPGVd (ORCPT ); Tue, 16 May 2023 02:21:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05E52D42; Mon, 15 May 2023 23:21:32 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766031080086419976?= X-GMAIL-MSGID: =?utf-8?q?1766031080086419976?= 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