Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1087570rwd; Thu, 25 May 2023 07:55:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6a6MY0B0vgbaUN4fD2ckTMj9FJ4wmuzZNgscJamQxegBBmh2DbcscQcqJyvWX6/UWXAxT1 X-Received: by 2002:a05:6a00:1ac7:b0:645:1081:98ec with SMTP id f7-20020a056a001ac700b00645108198ecmr8010750pfv.13.1685026518063; Thu, 25 May 2023 07:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685026518; cv=none; d=google.com; s=arc-20160816; b=DM0zGuoCeH7cRypQ9w/BO1knPrl6qyonPsKdv2jDkEpimWg9x4JLEgEQEWTalibRtk 33fczYP8NC64/g/+GtAPJWSJWAfMvqoXsNB7+Ci4udnfY15TwP0io7xQYw2huDgM5jf1 5GLR9rarUyNwmvIovOzlUTSsjS3eFY7QrMBvPx1AeUnFNbp93GPLVLPWoq55+Gq0VOE1 PqQRCdjukv577nNa632lEkAS6UtCRB4a367TRYjpnjD0HhFu4jYJ/nG8ja8QIqOROYvZ ZpPkDs1yxvxfRgDeh4K9mHgG0lAoTp941acWkY2/aePol/SsBgD6CEdv+XknLrOnUNM2 5K+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=c33tBT8cy9JPPgdRV9qNDNmoB5Xhj3TMTGSWoBJRi6Y=; b=kJFgHHnvgCCtRjOJ4AY7Lptx+Q2I4INZNnJKrf8E+wjJZygVblbRMP4TGXtC0j0kvJ lLxkFIUqy6GZVykyUbtj29W7IzFEqO9r/Y+PLVgVoqKCtD3IGSOLp6SMwO5TacFG+0IA 1A4G8rO0pSTo2ECbG1JH/wh+SOGRlex48+MIfxi2kOayQjM6BfSxCcF3nXX6cBS3FAMj QwWuG70JAI3hL+vgb6JUtDpm3//42Ll9wCtPclbDi6tO4+WOtil3C4no3ExqFurAkM38 GdhF87vX80qYyzlndEetEkAa1HYbAajqyQNSXQ/4+fiR+PmvKgWVFPnpjmMOL1EOSkPB OmIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=FYZ4Qv3l; 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=REJECT sp=REJECT dis=NONE) header.from=shopee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020aa79f81000000b0064f3fc8ec4asi1593043pfr.349.2023.05.25.07.55.02; Thu, 25 May 2023 07:55:18 -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=@shopee.com header.s=shopee.com header.b=FYZ4Qv3l; 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=REJECT sp=REJECT dis=NONE) header.from=shopee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241519AbjEYOIJ (ORCPT + 99 others); Thu, 25 May 2023 10:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241531AbjEYOIG (ORCPT ); Thu, 25 May 2023 10:08:06 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A7FC1A6 for ; Thu, 25 May 2023 07:07:45 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1ae4e49727eso14437505ad.1 for ; Thu, 25 May 2023 07:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1685023664; x=1687615664; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=c33tBT8cy9JPPgdRV9qNDNmoB5Xhj3TMTGSWoBJRi6Y=; b=FYZ4Qv3lhHI2M6JlMLNPzk+I50IUxOLOyogHAdzY/9dAsG8hcofW6kRBUtQtqme6eF El9ACrF9m6b/U1v8bIU9e6ogQnPYpCAlIPROFX03fQH6TtFmc+NpjRypzzUfvLQcCPgA IMmLH6zkb8bityx6mv4Sc2Ngs1jHgYVESI6kU386dGSu1gtYkoe5zYsIezw/Lbapda2D nzPd62vGlE4aAG9wK8L5blxg5ilcUkQLkzhsgEsNhgv0XLZ251TEbnLh/AN6hpKUPdj/ oCrWYI+n54m3SyBU4d/ncPb8TQUouvgBEbP8YkzUCmoCXR0LG38N128QLQtSZRlCobg6 IAWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685023664; x=1687615664; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=c33tBT8cy9JPPgdRV9qNDNmoB5Xhj3TMTGSWoBJRi6Y=; b=FOE+4D5dtTvx3tD9LgCo/psW0TL6FrN4yLOk8GRoK1bzZxwVEA16pgeFuqnOEFsL9O go06k0juE9AMuNRZsz9Jo7rHZTr2ig+JDcyw5LKoHYnP1eEiN7KGSwi1n8bCWYUijpvl hoVXHFjwnI+2pTf33NGQbO8HYkgM0axiK8LMsbZyFO/bgB0duGG+rHKn4X4gMbfOUf4i eSbUylxaUEWnALZGV89nR/vOooPDUMqSTVcaF0S833Syg41EuH7VxUmiiG90zzzR8PII +50I+a1pH1PNulUln6+GoWt8wuzIgHBNeBKv7lGl9jVFkSrklybkEDkgciMDZgVP//sH FyQA== X-Gm-Message-State: AC+VfDybCliUvOf9feILDbujsblLm1TDgj9hc1AQQM3mKo71gNDmzE1j ZsS/hKdylNWUf89MbYY4JenJ8w== X-Received: by 2002:a17:902:e88b:b0:1b0:f8:9b2d with SMTP id w11-20020a170902e88b00b001b000f89b2dmr856962plg.29.1685023664547; Thu, 25 May 2023 07:07:44 -0700 (PDT) Received: from [10.12.184.48] ([143.92.127.226]) by smtp.gmail.com with ESMTPSA id v11-20020a1709029a0b00b001ac5b0a959bsm1478099plp.24.2023.05.25.07.07.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 May 2023 07:07:44 -0700 (PDT) Message-ID: <5453d94d-c231-6d50-02bd-a510109bb306@shopee.com> Date: Thu, 25 May 2023 22:07:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 1/3] mm/mm_init.c: remove comments in zone_spanned_pages_in_node() and zone_absent_pages_in_node() To: Mike Rapoport Cc: akpm@linux-foundation.org, mhocko@suse.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230525040150.1588-1-haifeng.xu@shopee.com> <20230525082444.GT4967@kernel.org> From: Haifeng Xu In-Reply-To: <20230525082444.GT4967@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 2023/5/25 16:24, Mike Rapoport wrote: > On Thu, May 25, 2023 at 04:01:48AM +0000, Haifeng Xu wrote: >> Since commit 03e85f9d5f1f ("mm/page_alloc: Introduce free_area_init_core_hotplug"), >> free_area_init_node() doesn't get called in hotplug path anymore, so >> remove the comments related to it. >> >> Signed-off-by: Haifeng Xu >> --- >> mm/mm_init.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/mm/mm_init.c b/mm/mm_init.c >> index 7f7f9c677854..cf55bba04b23 100644 >> --- a/mm/mm_init.c >> +++ b/mm/mm_init.c >> @@ -1174,7 +1174,6 @@ static unsigned long __init zone_absent_pages_in_node(int nid, >> unsigned long zone_start_pfn, zone_end_pfn; >> unsigned long nr_absent; >> >> - /* When hotadd a new node from cpu_up(), the node should be empty */ >> if (!node_start_pfn && !node_end_pfn) >> return 0; > > I think it's better to call calculate_node_totalpages only if node actually has > memory and for node with no memory we just need to make sure all the node > and zone page counts are indeed set to 0. Yes, it's good advice. > > Then the condition here and in zone_spanned_pages_in_node() can be removed > along with the comment and patch 2 won't be required at all. Regarding to patch 2, if the node has mmeory but contains zone with no memory, it can avoid the calculation of absent pages. I thik we can add a check that whether zone_end_pfn is equal to zone_start_pfn in patch 3. If it's true, return 0 directly. So patch 2 can be dropped. Thanks! > >> @@ -1227,7 +1226,7 @@ static unsigned long __init zone_spanned_pages_in_node(int nid, >> { >> unsigned long zone_low = arch_zone_lowest_possible_pfn[zone_type]; >> unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; >> - /* When hotadd a new node from cpu_up(), the node should be empty */ >> + >> if (!node_start_pfn && !node_end_pfn) >> return 0; >> >> -- >> 2.25.1 >> >> >