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 474E5ECAAD5 for ; Fri, 26 Aug 2022 10:32:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1482940008; Fri, 26 Aug 2022 06:32:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC3B7940007; Fri, 26 Aug 2022 06:32:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8C5E940008; Fri, 26 Aug 2022 06:32:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 96759940007 for ; Fri, 26 Aug 2022 06:32:33 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 70AC914023D for ; Fri, 26 Aug 2022 10:32:33 +0000 (UTC) X-FDA: 79841379786.27.288692A Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf04.hostedemail.com (Postfix) with ESMTP id 2CB6E40012 for ; Fri, 26 Aug 2022 10:32:32 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id x26so1161632pfo.8 for ; Fri, 26 Aug 2022 03:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=wuqOv6Q2WHJryeaZo/bgjwLA2C78VwpKJa5KV+Zo29w=; b=5G0gjatnKWvLD6IiMZqkJDH3vBec1+BPrqWG5JRapFkq2SQELWs8bdoBDr3zLQ4O2m ToUORBLokZzfB5Zr2MqBrJtaQ7ywCPZJsjcdDyrgk3+DiCDTFWV9j1pSZF+fGuQmGosn Z6maqpnLdrjDEdwrMlpig7s06F8Nt/+rnqlLKevC6P+CwS/HiyQoiEGud03Ykdsuy2HZ MFSa8HUy6lka2IZwEot7Uv5ZjJpY+lO0M8r4nBXGU8SF2Ao2wBN/44WxOaAff5id93/p /Mxi7EX9VAFh+gz4DrTTfKXoxQWCDGIYuzRUSQ0k5ajkoe3e3PYtw6MnMzTfnqOh+4yV viWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=wuqOv6Q2WHJryeaZo/bgjwLA2C78VwpKJa5KV+Zo29w=; b=67NjhYQD/1XU9jh/zx18+tePdFl3VZbP6aluJN+HytWCQWyHdRG1OmhpCmgOT6I0y1 QfL77p2UaJSE6NGj55iNNIK4cmoAKGYXrNnX4vPAraofkv1ZTCtJqEQK/NOIAfiCGtbd uRIAbgYXd4EvGzXMa7ste8ouo77plqqOnqNxFrYxN1QJcnDx0d5j3/cTHlEarFmH/T76 ZBau2JtpD2mblDvllH6lBD2cPScFp8AHJlEBBt+iU2e1tILZxNBpt8YfmHIB/uKqXiwS q2Yx45gWstlal4jRwDBE2xnrqfLEwx9v21E3YL+cZxwPXaCzVk55Vcc8LEofJNKGMvdK 4mBw== X-Gm-Message-State: ACgBeo3y56D0KQSSYYO517fysnuAjjHEgptJv9xd/ULGtbtH2by8VrWe M/2m+AnVodx9lm/ulm2A1LE0cQ== X-Google-Smtp-Source: AA6agR7oM+ZOvnrqUme89chVvcTd9tAj5vskzDUlg5MF6QeOoOQ+AFvBN5KReA7YQ4/gpqtmQq4VWQ== X-Received: by 2002:aa7:8393:0:b0:537:701d:e7f3 with SMTP id u19-20020aa78393000000b00537701de7f3mr3297443pfm.50.1661509950855; Fri, 26 Aug 2022 03:32:30 -0700 (PDT) Received: from MacBook-Pro.local.bytedance.net ([139.177.225.241]) by smtp.gmail.com with ESMTPSA id r27-20020aa7963b000000b0052aaff953aesm1357008pfg.115.2022.08.26.03.32.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Aug 2022 03:32:30 -0700 (PDT) From: lizhe.67@bytedance.com To: akpm@linux-foundation.org Cc: Jason@zx2c4.com, corbet@lwn.net, keescook@chromium.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lizefan.x@bytedance.com, lizhe.67@bytedance.com, mark-pk.tsai@mediatek.com, mhiramat@kernel.org, mhocko@suse.com, rostedt@goodmis.org, vbabka@suse.cz Subject: Re: [PATCH v4] page_ext: introduce boot parameter 'early_page_ext' Date: Fri, 26 Aug 2022 18:32:17 +0800 Message-Id: <20220826103217.17393-1-lizhe.67@bytedance.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220825212338.e541d29ca3c4d602221f4925@linux-foundation.org> References: <20220825212338.e541d29ca3c4d602221f4925@linux-foundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661509952; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wuqOv6Q2WHJryeaZo/bgjwLA2C78VwpKJa5KV+Zo29w=; b=L/JUjyyzLz0RGCOgFrttmMlaKFVts8E8mb+FVx1++NGw1gG/nlwsTijKD9jQ8kC5rXrkUp aZRZNkmF+PIKqvEVM2fF9isx/3gYDfmCRdFvVUdlsNWU8l0vKLlYf/n9lRKMqbhIlt078o ZrMgov9p/Cq5aGBBz0mtVagiMAPS5VQ= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=5G0gjatn; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf04.hostedemail.com: domain of lizhe.67@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=lizhe.67@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661509952; a=rsa-sha256; cv=none; b=uynesv45zTjYETIehrBLcZohvLDX2hDsIo50v9aE0LbwDwznLcOQMfp5whbyLpr6MvdEb7 1p/z/6s3Ok+OOKD1pkBWALW4RSlcK5kmQgaS9HbTJLWbE5oVhEkjKTbk6qOworpiT4Hey4 WnuSgRa7kgxN9BSN2GsbNls3Ep+Rlzg= Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=5G0gjatn; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf04.hostedemail.com: domain of lizhe.67@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=lizhe.67@bytedance.com X-Rspam-User: X-Rspamd-Queue-Id: 2CB6E40012 X-Rspamd-Server: rspam10 X-Stat-Signature: aipse7mgkfs597ypzfixtiis1mwx8z3m X-HE-Tag: 1661509952-42364 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 21:23:38 -0700, akpm@linux-foundation.org wrote: >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) Sorry for introducing this WARNING. I did multiple checks before submitting the patch but unluckily I didn't trigger this WARNING. Maybe there are some differences of config in our compilation environment. I have tried gcc 8.3 and gcc 11.2.1. > >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; >_ Thanks for the fix. I try '__initdata', it triggers another WARNING below. WARNING: modpost: vmlinux.o: section mismatch in reference: memmap_init_range (section: .meminit.text) -> early_page_ext (section: .init.data) I check the section tags in include/linux/init.h. It seems that we don't have a better choise. So in my opinion, your patch is the best solution.