From mboxrd@z Thu Jan 1 00:00:00 1970 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 93AD5ECAAD2 for ; Fri, 26 Aug 2022 04:23:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B756940007; Fri, 26 Aug 2022 00:23:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 967456B0075; Fri, 26 Aug 2022 00:23:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82EEF940007; Fri, 26 Aug 2022 00:23:41 -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 73EA36B0074 for ; Fri, 26 Aug 2022 00:23:41 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3E67F1C6DB5 for ; Fri, 26 Aug 2022 04:23:41 +0000 (UTC) X-FDA: 79840450242.27.A0069EA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id C93882001D for ; Fri, 26 Aug 2022 04:23:40 +0000 (UTC) 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 E018C60B5C; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661487820; 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:dkim-signature; bh=1AE7dZG8c/2xjkvym8h51P4bWfUxH8xT7e8vdffAxiM=; b=8rI8MsnsPVS6ZBz7eF8A00bODFtBNFfCCHU4dAkfiKeFtPUsMpUf395v7SlK+6Up+Rs6mK KjBRQND9ev+j9bxbQLgduuXTckozsBaboccyVH9R2iHAT7KRjMlRjM45pdbPT4V6B7bXiP 0hh19MgRS72uDB06QoajbisL374FO9E= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=swRBl+cy; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661487820; a=rsa-sha256; cv=none; b=giJRl78IOZKQoDnNR5VweW9Fkds4/OyJ6FOytLSHlnYa+LzhUMAefBxMGWcQgvyPYCe63E mwaqr6yqViG1ZoN5bLGCp3Ml+YJYiCjUkwkXU9gIp4IWqZTWbT1TQtCl8Zj8It8H+DAW6M ufdSOB8EK0bNckXx3q/TO9qP1G4Sq5U= Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=swRBl+cy; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C93882001D X-Stat-Signature: xxa58yxw3tqcafuucr637y87fktitfmj X-Rspam-User: X-HE-Tag: 1661487820-512275 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: 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; _