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 E38ADC28D13 for ; Sat, 20 Aug 2022 01:06:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37B078D0003; Fri, 19 Aug 2022 21:06:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3299A8D0002; Fri, 19 Aug 2022 21:06:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F2788D0003; Fri, 19 Aug 2022 21:06:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0F3748D0002 for ; Fri, 19 Aug 2022 21:06:11 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D87DAC0448 for ; Sat, 20 Aug 2022 01:06:10 +0000 (UTC) X-FDA: 79818179700.24.07AD5CE Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf31.hostedemail.com (Postfix) with ESMTP id 56A8E2002B for ; Sat, 20 Aug 2022 01:04:31 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id x15so4787680pfp.4 for ; Fri, 19 Aug 2022 18:04:30 -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=/Y5lHtfDOgHcOef5HSbxzPooyar/bKM8Dwba8ypxoL0=; b=SW1MjJSeP+bDFGAYJxSKETSxuG2jBpYoerBwoNQqzarKzWwN28sxiyJs5P7fZV7qAG fab5B9F8IOzSjFfAPRoVeYamd0IoeUeXzNsYd+BxTOME63q2j99lTvLU+IY9b8zwVlOk XK7BX4rECknKAK/Miv7Fbn24etobKUslgNTqkjwhDbZOHm7svVJORx49CGk6IExNIfg4 hKfKoVxJ8ddjkX70fJ37f7s1DN88zplVptRZOUwOQuCc/1Tkjo64DZqvr4SwVhsC2aq1 uDDPHQXc+aEfxlojRhIECgbRUoQVVWX7DNyBmVpdHZXolPq5Ru+iuVdFhKuSqpv+rHcr uZvg== 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=/Y5lHtfDOgHcOef5HSbxzPooyar/bKM8Dwba8ypxoL0=; b=oJAox2EhhNat107d/YzCOHnOjY7hra7sBuyfa7hT4GoFaljfqcamYlwMPLfLmGWaio 8ZY6IKphnM/LZgA49Tc/41qOoNwl2UJgvllXbQ6vJpZz7tU7VCnbmm2bMVSGTnhSsMJ5 npYFbPu6ZrazLKT4XfX+AbKiTFp67DKx3HLgV3zmmxensQsm5qchOukzi9nt2gil444L Q9F2fZJXRRkEHNgTzfmGO2rEgXCgUwnPOvMzIR5cgAtnN/8hnS7Z1bd9kK2cK6b656/T jf/lM59Q8cJoCKSDQjtxTWqn0xn8Khauki/wrXFM06YTOpWuMP5w+K+JGns3ux+J/Kwd FLQw== X-Gm-Message-State: ACgBeo1JJaQXN0ZyAlWRWuuESJCZbjTWz/S87IyePjpjLnm2q8WquF2I sF0FopXKyYyzKqwd0yLPO10sLw== X-Google-Smtp-Source: AA6agR4nU1fIGgyts2XcWTJye531TNjPdUDubtz6CAhtah7FRLyOIU2IGuSlibJr2UElMQCM1qMuuQ== X-Received: by 2002:a05:6a00:b4e:b0:52f:59dc:70 with SMTP id p14-20020a056a000b4e00b0052f59dc0070mr10481781pfo.2.1660957470082; Fri, 19 Aug 2022 18:04:30 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.248]) by smtp.gmail.com with ESMTPSA id j18-20020a170902da9200b001714c36a6d9sm3718881plx.229.2022.08.19.18.04.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Aug 2022 18:04:29 -0700 (PDT) From: lizhe.67@bytedance.com To: mhocko@suse.com Cc: Jason@zx2c4.com, akpm@linux-foundation.org, keescook@chromium.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, rostedt@goodmis.org, vbabka@suse.cz, yuanzhu@bytedance.com Subject: Re: [PATCH] page_ext: move up page_ext_init() to catch early page allocation if DEFERRED_STRUCT_PAGE_INIT is n Date: Sat, 20 Aug 2022 09:02:57 +0800 Message-Id: <20220820010257.11488-1-lizhe.67@bytedance.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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=1660957472; 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=/Y5lHtfDOgHcOef5HSbxzPooyar/bKM8Dwba8ypxoL0=; b=15pVq0Z7jXybat4pZIr4Bd6HBrCscWtT125yd/bSicvIPo5QPDzvkHVwOBhXHD8JI912aC lNtiEmua0RmVnSweJJHNsiYQSwaQ/rGb/SlxyRG9+haK2DKk2lapj6cyEeaKZLCePi+tKF 1IDEo2EcrrIcy4NjhbINPtzRzQIrwh0= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SW1MjJSe; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf31.hostedemail.com: domain of lizhe.67@bytedance.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=lizhe.67@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660957472; a=rsa-sha256; cv=none; b=SePqBU8RGjVY9pqJjR5qK0EYmbUCso3OL6H9RF6TpUKl00anelvhw4m6HBUrSTDdvrbgW0 izE5ysnXZNspV3x2RSKzVv74Jl44IVOjY7PzLMRDLI6hN8dp1A2g9PKOqqMgBY+aF3zE/+ s0bcmeG9noNpCZoLCyWO+d+OMBvN77w= X-Rspamd-Queue-Id: 56A8E2002B X-Rspam-User: Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SW1MjJSe; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf31.hostedemail.com: domain of lizhe.67@bytedance.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=lizhe.67@bytedance.com X-Rspamd-Server: rspam04 X-Stat-Signature: tq8jwmjjuo43rjik8369s7dizmcyumnu X-HE-Tag: 1660957471-906725 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 2022-08-18 7:36 UTC, mhocko@suse.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 move up page_ext_init() to catch early page allocations when >> DEFERRED_STRUCT_PAGE_INIT is n. After this patch, we only need to turn >> DEFERRED_STRUCT_PAGE_INIT to n then we are able to analyze the early page >> allocations. This is useful especially when we find that the free memory >> value is not the same right after different kernel booting. > >is this actually useful in practice? I mean who is going to disable >DEFERRED_STRUCT_PAGE_INIT and recompile the kernel for debugging early >allocations? Yes it is useful. We use this method to catch the difference of early page allocations between two kernel. > I do see how debugging those early allocations might be useful but that > would require a boot time option to be practical IMHO. Would it make > sense to add a early_page_ext parameter which would essentially disable > the deferred ipage initialization. That should be quite trivial to > achieve (just hook into defer_init AFAICS). It is a good idea. A cmdline parameter is a flexible and dynamic method for us to decide whether to defer page's and page_ext's initilization. For comparison, this patch provides a static method to decide whether to defer page's and page_ext's initilization. They are not conflicting. My next work is trying to achieve your idea. -- Li Zhe