[1/3] mm/mm_init.c: remove comments in zone_spanned_pages_in_node() and zone_absent_pages_in_node()
Message ID | 20230525040150.1588-1-haifeng.xu@shopee.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp101309vqr; Wed, 24 May 2023 21:17:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6A0jYVeUFo5wu2EAbsEPSZG+w/NQIVQOpYqlJKG9pZf/FmIizwYGiNW7fDQ4Ee7mOfO5Z1 X-Received: by 2002:a17:903:22cb:b0:1ac:a88a:70b6 with SMTP id y11-20020a17090322cb00b001aca88a70b6mr269670plg.31.1684988249778; Wed, 24 May 2023 21:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684988249; cv=none; d=google.com; s=arc-20160816; b=Zea4xiwr8aKnyl+DjgbtMKD9Z5J2p+japH+IWEvjrVqPzET919NVGzJynbko7+vRtC IhYJq5v5jZBM73R39rE7Wjx9XKd5dFH5V0bMkEysH3SGn07DqlCi7z+7BTxaQ0YHTnQZ 7Pob7xg4+FnGF5UJYgSO/ySohky+q4DzBmgXjPjTNe0fXVYWR5jWS+rt8+xcKScBqo7s P62P1Jt3PgCsyN8gYrcIsKYvh9H48/3AfopPQBNO6P2++ZEIEwQLRWJwcoqppIHUmL1D 2k4nffTY1xklsPAUahHJGjtjSiXz0PiTVjHjjTo3ClHXM65vAnWa2umsXev84thh0Mwo rEpg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ANsIwyslEqWqt/AnM3EiaC6NohGcLnN3qIazUJUVzP4=; b=Xl+XRzpOb+3XDiYg+4salb9HL1dtEYgzM3KaPXOKLk4MbD8t02Z14vAMkYGIlSfrlX 2ST6sP9qZB7fyRDj3Q3c/1q5HBiUfuXmK2tGI3wN80UMUC8RBYvpm9mCnRs/pJNSRvcn lZ4WgpXDj8caFOQ+uw39IxCS5wZZkIH5D9i06faTqWeQIHjY7Hq4GGc9e3pOMvjfgkqv k82+3cRu5EKWcXSB8Si4ifVd5FMQ63IpOC0vIC+14tf3v6Ni2KtadVnNRmlNOnz2AK0L myz/7h/SVgvS+lGx7hxUfpna2fhctTj8ESkeBlol3MfLt7uqZlpwS4XkhhnNNE8pgrlD tHCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=NQJaaIdz; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a1709028bc300b001a92f0f46fbsi497854plo.436.2023.05.24.21.17.15; Wed, 24 May 2023 21:17:29 -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=NQJaaIdz; 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 S230118AbjEYECu (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Thu, 25 May 2023 00:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjEYECs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 25 May 2023 00:02:48 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54649135 for <linux-kernel@vger.kernel.org>; Wed, 24 May 2023 21:02:47 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-64d24136685so413506b3a.1 for <linux-kernel@vger.kernel.org>; Wed, 24 May 2023 21:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1684987367; x=1687579367; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ANsIwyslEqWqt/AnM3EiaC6NohGcLnN3qIazUJUVzP4=; b=NQJaaIdzuOmU2ZfoUS/HfLXDpN2lpDz6rxgmnio+kZPpgUMm8yFkHv0hT8FTIcZdVt Ro2TjOvsYI8Sjxrlcl9/rf95KDbQVHMgA1b5mYpT8p72lDYlZA1C5tZy72BZcjaAxdWv 5LloYVYAxTGN2gD10YUAommoIjdIy/149C79MorSY1AtC/EmTjZy/5Hg0tgXhtqZ/Adr CiNne8GdcsARkuTNHNT6MOFjZ+iM6Ydix0MCy/3hqzvExsAklMKN0t5GFNMkV3NW//HI n07UXJRmrOF6W2ZNXMqSbRAxdQBg4fDRbECDjakujwM97aOUZD9iU/igqiVV9oKC9mxF Ghjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684987367; x=1687579367; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ANsIwyslEqWqt/AnM3EiaC6NohGcLnN3qIazUJUVzP4=; b=V3nxlHfZg+9F8m+NXlsjC0Szs6tR/e8rgBtt1KauIlgRnHPb9s73vge3AcwwUXKZcq kDZnuNMH78yH/VzvrZ+rpOjOE/pBK9fwRVc9pq2MuMcYjC70xMoRmPVCB1F45w//exul bEbbS0suDj28zNGeanUS0fSI6v7+a5w8pJcCEYHqJQxyCTr6ED5p4Hf57pfh09BhoVEm 3rdV9aZAnFgzQWaQBnbB8oYTusCRvPxIzvQXYH4FoLjDIIxzsXb5OGOBY6aD1sMhk/GD JmXBrNGDIvCVaSxIRGAW9Qw6o6+kOBkkvbZpoD5zmwdvrXC8at+5+laDt+mRkfePzyRo DSMw== X-Gm-Message-State: AC+VfDwFgKCziULzV2w/Q8bnvC51xc1ktgPSeclSu6a+wTKISLUR93qN 7gQ/t1BDbjo0E0D5T80aeueaIB2HVLlHgaqLdUktl63A X-Received: by 2002:a05:6a20:748e:b0:10c:b9ed:6a3f with SMTP id p14-20020a056a20748e00b0010cb9ed6a3fmr1539402pzd.7.1684987366781; Wed, 24 May 2023 21:02:46 -0700 (PDT) Received: from ubuntu-hf2.default.svc.cluster.local ([101.127.248.173]) by smtp.gmail.com with ESMTPSA id i11-20020aa7908b000000b0064c56d04316sm189916pfa.193.2023.05.24.21.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 21:02:46 -0700 (PDT) From: Haifeng Xu <haifeng.xu@shopee.com> To: akpm@linux-foundation.org Cc: mhocko@suse.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Haifeng Xu <haifeng.xu@shopee.com> Subject: [PATCH 1/3] mm/mm_init.c: remove comments in zone_spanned_pages_in_node() and zone_absent_pages_in_node() Date: Thu, 25 May 2023 04:01:48 +0000 Message-Id: <20230525040150.1588-1-haifeng.xu@shopee.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766838238818194320?= X-GMAIL-MSGID: =?utf-8?q?1766838238818194320?= |
Series |
[1/3] mm/mm_init.c: remove comments in zone_spanned_pages_in_node() and zone_absent_pages_in_node()
|
|
Commit Message
Haifeng Xu
May 25, 2023, 4:01 a.m. UTC
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 <haifeng.xu@shopee.com>
---
mm/mm_init.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
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 <haifeng.xu@shopee.com> > --- > 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. 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. > @@ -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 > >
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 <haifeng.xu@shopee.com> >> --- >> 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 >> >> >
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; @@ -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;