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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D7D1C43217 for ; Thu, 20 Oct 2022 21:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbiJTVyk (ORCPT ); Thu, 20 Oct 2022 17:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbiJTVyc (ORCPT ); Thu, 20 Oct 2022 17:54:32 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 470133FD55; Thu, 20 Oct 2022 14:54:28 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id f14so630316qvo.3; Thu, 20 Oct 2022 14:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ShOyVALLWkkR4pnZbEXjhmF6LOSGNE0eOMv5EosjK40=; b=LmhsWLB5/8ER2JWGrAWt10ivNX62HhMvv1xr1WhLa8oIGbqE6gfaxeCqdv3/yMH1rg rupS1AoSzdDIE3sKhGSRgJ5JtZIE2Z00oJDsRRai1sGmU5SFhOf536G/b4t9VgZqOm8F +8bmWW2eKxJu2t/MLePJJ0YkKGitQ6cHO2DxfYvC2u+IkGry12ZDQ/MP4rOrSu4d0NBa MLgsBVxBgLZaAXLnaneL/ROAKOtw8peTXm6aE7CAIo2L/Hroz4ZJeq4htcoLmT07Awdi EIVo+KmLfCM/6yslbPviiQniqDYINEwRj+mLjivLeu4/7v5eVh8YdXUaSnwxQxIi1Kgy VU6Q== 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 :subject:date:message-id:reply-to; bh=ShOyVALLWkkR4pnZbEXjhmF6LOSGNE0eOMv5EosjK40=; b=cf8mF6/vmPdHFRdKW3sMsOueoyEc75LTS8BejOiA8kFNKHYXtPTUatRfcwbCgHRQW9 QiNDeLYroWRnrZ864iY9qOpVlkwTSMji1/EjSy6RAXX+REYzpDFaytzncIhO4brykbBV iT2iunS4WgonkU3hmL74pshuh8q1bqkPi6D/5Bwv22HJ9Jbwtw3a3Rxf/ZbDjBBkZgPX 8mNm9QymVTC6KwKDfnFKtkJWCsuSTYpSX4LlmH9Q2z3A2VjNjcK4Rg7tI18q62CoUR9M RmKb87gtk0XbNWM2/hrnSoUJvvWdjMyPGO1Z0rJVu9fzAz/F7iHB77ecxhbf+QDBcgVY ++9Q== X-Gm-Message-State: ACrzQf3cjF3TEIqwJ+CIIvidv4BSyiwmjcHMTmJl8qofuVvw+h2330z7 cn0qsg0wY9omwtofmF3sIFY= X-Google-Smtp-Source: AMsMyM4hvvi4L9JYqaXZOTFe/8FS+MJ1R0MvB72qG3wAneUbZ7hAzYBbeQWK/BxtpwbfBfx5iBtOJw== X-Received: by 2002:a05:6214:20a8:b0:4b3:d99f:2588 with SMTP id 8-20020a05621420a800b004b3d99f2588mr13740927qvd.64.1666302867022; Thu, 20 Oct 2022 14:54:27 -0700 (PDT) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bj41-20020a05620a192900b006bb29d932e1sm8121067qkb.105.2022.10.20.14.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 14:54:26 -0700 (PDT) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Mike Rapoport , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Muchun Song , Vlastimil Babka , Johannes Weiner , Michal Hocko , KOSAKI Motohiro , Mel Gorman , Mike Kravetz , Florian Fainelli , David Hildenbrand , Oscar Salvador , Joonsoo Kim , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Doug Berger Subject: [PATCH v3 2/9] mm/page_alloc: calculate node_spanned_pages from pfns Date: Thu, 20 Oct 2022 14:53:11 -0700 Message-Id: <20221020215318.4193269-3-opendmb@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020215318.4193269-1-opendmb@gmail.com> References: <20221020215318.4193269-1-opendmb@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the start and end pfns of the node are passed as arguments to calculate_node_totalpages() they might as well be used to specify the node_spanned_pages value for the node rather than accumulating the spans of member zones. This prevents the need for additional adjustments if zones are allowed to overlap. The realtotalpages name is reverted to just totalpages to reduce the burden of supporting multiple realities. Signed-off-by: Doug Berger --- mm/page_alloc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e20ade858e71..92908c51f1c3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7542,7 +7542,7 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat, unsigned long node_start_pfn, unsigned long node_end_pfn) { - unsigned long realtotalpages = 0, totalpages = 0; + unsigned long totalpages = 0; enum zone_type i; for (i = 0; i < MAX_NR_ZONES; i++) { @@ -7573,13 +7573,12 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat, zone->present_early_pages = real_size; #endif - totalpages += size; - realtotalpages += real_size; + totalpages += real_size; } - pgdat->node_spanned_pages = totalpages; - pgdat->node_present_pages = realtotalpages; - pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); + pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; + pgdat->node_present_pages = totalpages; + pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, totalpages); } #ifndef CONFIG_SPARSEMEM -- 2.25.1