Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp123667rwb; Fri, 19 Aug 2022 18:29:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR5sla9NgUTI/rJxqFLkTKRXLNX7WChdwspUr5iISD7CCWdq4yPinIxtJC9HrI4euZDWFyYf X-Received: by 2002:a17:902:e850:b0:16e:808d:be2e with SMTP id t16-20020a170902e85000b0016e808dbe2emr9688383plg.40.1660958945611; Fri, 19 Aug 2022 18:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660958945; cv=none; d=google.com; s=arc-20160816; b=zPGSZk69Ee9dTMRH3d6Hye5ibCkSsUsFNjULefCEA2NBeK+sEHpjXFXhwReO0vtrcT Qs1kFEiQSDfhgyeZtcuVcV93Yt3iOnvPRK4mgH6DT0nxenblTslL6GMZvTQMebKaEKkQ F/EKqX+fOeBBmeBEscZxljxi+brOpHi78HD8YHXFg0iwOZYWQHIiFak7D9MnBPZyEeMX icVO2ACPXj2jPedQnnmxE5d8/VQsQZ0a2z4QFabU7rrWoDOpgKoiEtUjiTlGuLvk6EWT ja6lKJaLBcVn5zaFwCBlVCD2VqvLC8cf1HqcZsjSQZ4kOQ6zuU0llZ5AoQSFx5TJrKC2 1ZBA== 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:date:subject:cc:to:from :dkim-signature; bh=/Y5lHtfDOgHcOef5HSbxzPooyar/bKM8Dwba8ypxoL0=; b=Xfl1ZAIQWBaFBjyyL8Rc+ANBjExUBjQe9PG6D1RVk+et7xyijM49BEhK8Uv6ShKRaq cTqc47wpG00anh17gTzgZ5PEwaQ1GDIajAB3gYzVXDMfqN2yfd6b8kHdYehbf0UKe1u1 uMY3FE5oC7Cryhs3kCiyiV+f1x08wHr6QeGNTcmU9YIp2SEtaPtvApPyQDpci/Op9qtl 6kL6c+nUKNUp9eokhANRaPczvbmlbqPXuvjJt/8ZP4M78iCyuMfAHfjD0e8/4++ANze9 i8l/o+AOfTZ8YMHjFh4+u85z1u7kfOPSfueAWZ7pWBjiJVZK+m7a59ih5o4eVbtqw9LL MFGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SW1MjJSe; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk8-20020a17090b4a0800b001f2c5c02eb1si8725809pjb.117.2022.08.19.18.28.53; Fri, 19 Aug 2022 18:29:05 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SW1MjJSe; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244727AbiHTBEe (ORCPT + 99 others); Fri, 19 Aug 2022 21:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbiHTBEb (ORCPT ); Fri, 19 Aug 2022 21:04:31 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F662103C4A for ; Fri, 19 Aug 2022 18:04:30 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id y141so5678972pfb.7 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=bsRd+1u9FmoyjcN/5CqWUEj3C3o9KcyFijXXlC5bc2W7cgsnvs+ShZIOcuL4D/xnjb RIQslbAZR+Pk/P/Orj7dJu1PRm4XtVwz+u7xxcS3+IYAx//BQDDbAKnuRjl5O2/r2bF/ EfbY6/rWyw7BxoUrNVuGOlv/M8ae57SBhyHCfrS3LMHAoH/ogMzRXPiGY0a1MgLjkl3i 8SOrzmp5f0vR7qr7Evxznr9xRyUzMxt/vaakKEJAuDmSRF3RXgmYhQrvyLBNVe0+6/Im mgePLeZa1EXklNzmQwU/8golp+3LQtxKmmY1iLciG/zbb9CKSfdEPCDUkut0zj45QbM9 iEYQ== X-Gm-Message-State: ACgBeo3OJYB6ZAJD4GZoNDB799bGa2mZHcSSLO5DGgFFeFVRQf6z+ody GtMUnWH6Y+GbS3C9OZIBGr/0SwBWHXUrJvou 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 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