Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2036869rwa; Mon, 22 Aug 2022 00:28:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR56vmSp4/uA9fiu6qcFQHh6Hb0V7Lzy8eDDCkxKzbMlwEpnzdlw5AhSk6HCdSTjzWkC/7tk X-Received: by 2002:a05:6402:240d:b0:442:b0c4:9e02 with SMTP id t13-20020a056402240d00b00442b0c49e02mr15251808eda.210.1661153286874; Mon, 22 Aug 2022 00:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661153286; cv=none; d=google.com; s=arc-20160816; b=uD9hzeyEu0qrU82GbNfAJwEKAlOv/yAyim15waeCw4Kq6hna7Q6hz/wAocn2KaxEeB ztq8bxYSYrVT7yBjeBFVt9vqwY1QjlnobJhUtTy80tu9SJphvGc07k8vhzEStF02BZpu 9Y/zHjYSO/cOwf4eyMLUJvDxOg9lbK1Qe2I2kAT/rG4j5+ZT2Hm1gRV9epOHegQ6hLu1 6WQpZexi5QARAZQdoAiFwtYycRIgxIgy+o+cHx7/VA0TLrGH49HqIS7Hh4ja9BCaZD0h JRguBkfUTl9sfOlNfT3RICCA2A8kV4F87BslDE4pz7L70JwFXGBj6dtTMh/IvNgjwf/F 2j1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NA0kLecKkbEPuy+QziXKxLugfBAhixGPNsxIPQUKjGI=; b=XsTVX0a/IOU5z/RteHLJJoMcnmr8zPC0kC3hwmQXXXzcnPaONVo8WpIgoD3An+E/D9 D/ZHysXYgW+8hCG9oQePQABXa932JfIl33QbUqjRcsQhXCaWC0A1baryac3L1btnIIMn RJAuFAucGQGWyVUU8z3FHkWluvqmdYTDmGl32pSsLnlE1o9tIIFJGOP9thoiqxg1iMlm iMFtkQdXzhIHIte9H1dpKvpoDnv4zvDaraHbnGq3yH68JspYhYWFnnW5AqPVv8M9+42/ FxPPzuc0mMl6PkHlf/R0qhnX2lFLbFaIXtW1AL7lfLrhN4w+MWoKK3sU9phsIzx9+knt nr4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=kSpDNWZg; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb7-20020a170907160700b0073d85d36f86si933905ejc.724.2022.08.22.00.27.41; Mon, 22 Aug 2022 00:28:06 -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=@suse.com header.s=susede1 header.b=kSpDNWZg; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233041AbiHVHIt (ORCPT + 99 others); Mon, 22 Aug 2022 03:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232950AbiHVHIq (ORCPT ); Mon, 22 Aug 2022 03:08:46 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D35513D5F for ; Mon, 22 Aug 2022 00:08:44 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4B4CF33E10; Mon, 22 Aug 2022 07:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661152123; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NA0kLecKkbEPuy+QziXKxLugfBAhixGPNsxIPQUKjGI=; b=kSpDNWZgJw9yZTi2McPVhwPWreQnHY5cQwBre6r6eFLvm8dSmq+mEDVSYaqsS/D8qOmZX3 +phgH4Bhdk6ki0dllOoNJ0SD3nACn+3ODSxmQLQse4qjV9ouRF0Xk/lZNEAtzXwX0Gxv0X SpJgjITa4gv9mXJJ9nvjZfaXoZZfCl8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 274A513523; Mon, 22 Aug 2022 07:08:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EkXSBnsrA2OfGQAAMHmgww (envelope-from ); Mon, 22 Aug 2022 07:08:43 +0000 Date: Mon, 22 Aug 2022 09:08:42 +0200 From: Michal Hocko To: lizhe.67@bytedance.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, 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 Message-ID: References: <20220820010257.11488-1-lizhe.67@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220820010257.11488-1-lizhe.67@bytedance.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Sat 20-08-22 09:02:57, lizhe.67@bytedance.com wrote: > 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 was not questioning the functionality itself but the way how it is achieved. Recompiling the kernel to achieve debuggability has proven to be really a bad approach historically. Most people are using pre-compiled kernels these days. > > 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. They are not conflicting but this patch adds ifdefs and additional code that needs compile time testing with different options set. I.e. it adds maintenance burden for something that can be achieved by better means. So if you are ok to work on the runtime knob then I would propose to drop this patch from the mm tree and replace it by a trivial patch to allow early boot debugging by a cmd line parameter. -- Michal Hocko SUSE Labs