Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1305901rwe; Thu, 25 Aug 2022 21:35:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR4F+ptjcfBrtcLdL3KnOvgkK4wSD/WXOX0vq4xR4SL2kmzqkZsIdlidUX61TWVgLDKQm8Jk X-Received: by 2002:a17:907:7d8a:b0:73d:6c6a:1bc7 with SMTP id oz10-20020a1709077d8a00b0073d6c6a1bc7mr4530198ejc.26.1661488531412; Thu, 25 Aug 2022 21:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661488531; cv=none; d=google.com; s=arc-20160816; b=eWKrspquHHjU3IILOvIfKMqpGi9RnCNTg+GPbZCwuTT8a6YSQH7vQ2Y9AnSQhIqEea BKc0XpBBELm4WKxbiMbcJYaM+3+8bXtV87na4j2ACudfIi9uXjoSQg34J6GPSFM9tyzI cvTXHgZSem8Z80bzwq+WkC3fEoidyzIXYoHDZoU8n4bI4GKKzZ/OZon1v8O7IpWClsKb xJk94xwHC4dJebujVA1Bwi9h4a05XXyASQctRc1ZuR+8L0mrjxc2tz+0dcxrRsD28hYP q19Biui5jSRz1UfPq0T9J8iRi1nP3uNawRdaI+20yBt4CVXZX6HfDtIbYOYMZOonj9l9 c6Gw== 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:subject:cc:to:from:date :dkim-signature; bh=1AE7dZG8c/2xjkvym8h51P4bWfUxH8xT7e8vdffAxiM=; b=AdMqvsVAgnt7TUj4t/Q8SujsZ+ESlozE21B0hfSrGmA+CsGt38EMnrgx6xHt3P2JV9 1++HNFBAdvBSeSFfDKK2UDVCJ6Q93CmMBuPZz56gL7CcBNIncoaR1wqhLzYEeEW7FRvo JJXkN5VY/8EFeCdUue+PgF650LLoiCeXxiAxLFW3PU32EKbKgpwa84vwknoxKKgtuWWl uYn61w7rTkdNOe14hGtiTI8d1fdUQ/5kPfhw8jYhl+2EdYu4HV6xXHaHDScFufwahj5i hjZNkGV3i3ZpaD2C9E8jO8Gx34lBK/BophGjn5dNkflp5gxG3KY9sr3XakVEL/52U6ga z8CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=swRBl+cy; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb23-20020a1709071c9700b0073fc8e72882si342622ejc.28.2022.08.25.21.35.04; Thu, 25 Aug 2022 21:35:31 -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; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=swRBl+cy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244545AbiHZEXm (ORCPT + 99 others); Fri, 26 Aug 2022 00:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbiHZEXl (ORCPT ); Fri, 26 Aug 2022 00:23:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 643F4C6FD6; Thu, 25 Aug 2022 21:23:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F021A60C8A; Fri, 26 Aug 2022 04:23:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3326C433D6; Fri, 26 Aug 2022 04:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661487819; bh=jcg147D1yDM5q55rbfjcwOEpR6Qg0owFbIE79hxnzdA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=swRBl+cyscwpbrkmIlJVa2MyakZTR2Xj5+P98F6XCQZ8AmmqwbgR2wcJlW2edLZ5U yQN1WMR68osbCltgUgpxR1+M1PhAAM2NHtlTWrgSnAoxeWGTCkxrIwExVBq31sUkzP WrTk9NO76jkek3Rw2BV+oSvjEDCer18TgD8Hkkho= Date: Thu, 25 Aug 2022 21:23:38 -0700 From: Andrew Morton To: lizhe.67@bytedance.com Cc: mhocko@suse.com, vbabka@suse.cz, mhiramat@kernel.org, keescook@chromium.org, Jason@zx2c4.com, mark-pk.tsai@mediatek.com, rostedt@goodmis.org, corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lizefan.x@bytedance.com Subject: Re: [PATCH v4] page_ext: introduce boot parameter 'early_page_ext' Message-Id: <20220825212338.e541d29ca3c4d602221f4925@linux-foundation.org> In-Reply-To: <20220825102714.669-1-lizhe.67@bytedance.com> References: <20220825102714.669-1-lizhe.67@bytedance.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, 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 On Thu, 25 Aug 2022 18:27:14 +0800 lizhe.67@bytedance.com wrote: > From: Li Zhe > > In 'commit 2f1ee0913ce5 ("Revert "mm: use early_pfn_to_nid in page_ext_init"")', > we call page_ext_init() after page_alloc_init_late() to avoid some panic > problem. It seems that we cannot track early page allocations in current > kernel even if page structure has been initialized early. > > This patch introduce a new boot parameter 'early_page_ext' to resolve this > problem. If we pass it to kernel, function page_ext_init() will be moved > up and feature 'deferred initialization of struct pages' will be disabled > to initialize the page allocator early and prevent from the panic problem > above. It can help us to catch early page allocations. This is useful > especially when we find that the free memory value is not the same right > after different kernel booting. > WARNING: modpost: vmlinux.o: section mismatch in reference: early_page_ext_enabled (section: .text.unlikely) -> early_page_ext (section: .meminit.data) WARNING: modpost: vmlinux.o: section mismatch in reference: early_page_ext_enabled (section: .text.unlikely) -> early_page_ext (section: .meminit.data) I did this, but it was lazy - perhaps there's a better-optimized combination of section tags. Please check? --- a/mm/page_ext.c~page_ext-introduce-boot-parameter-early_page_ext-fix +++ a/mm/page_ext.c @@ -91,7 +91,7 @@ unsigned long page_ext_size = sizeof(str static unsigned long total_usage; static struct page_ext *lookup_page_ext(const struct page *page); -bool early_page_ext __meminitdata; +bool early_page_ext; static int __init setup_early_page_ext(char *str) { early_page_ext = true; _