Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7047467rwn; Tue, 13 Sep 2022 13:00:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cRL8rZIuzHU/KUurKP2ojNw8cTswxdQBLco834idzgRla6TLETYK+SOegHtbYRw874WNq X-Received: by 2002:a17:90b:4acd:b0:202:e381:e650 with SMTP id mh13-20020a17090b4acd00b00202e381e650mr948607pjb.204.1663099231606; Tue, 13 Sep 2022 13:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663099231; cv=none; d=google.com; s=arc-20160816; b=Au6BjrBycK/Y/28wAromPCBTXKCD9qX5wwDcEzClrWQjPgv9jrpqI89ypnHsPaTSEd DHxFPwzfw0jyAsEqrosloFePlXH40IXioeLKzAgTWR0To7as3U7zuAqbna+0lUX7ypOT MWa60a161zmh7D9wOEYhNHWI0bJsNVcKzjA4EEhicdjzMAmW2grTG/MxrLYO3pCrBqNT Aj2MRIYyvUcmjLw5wsGPlnoRCmzZl8mmwPe0T/p0PIXkfPa6XSzfJ819j+YCcwkaLh6n /B2wAZjr9QJklbFS3H1JYrt1+gl0vZ5J/c1b7sW6rTWO0zUlsIbXAjBMKjvytqHs2myx ZG5A== 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=kefl6D8eKpN1GxKRqpPd+2PbW8yMD7NaxrgEOy2EJKU=; b=dySJfITgx74SO6lBLPB920HA9IspaM7o+SUw/qA6B0M+TW+19gMKhmZEkI4HVKvxg2 3ZaoTQfgvfBODgSYlh0EkDjUd+v9axRY3DgY/GNRm/ZBbPHWKBLfKFYtgnz3jtZMGvtX spZjPiHfp0E3UbvEBDmpoOQ7+pY8+ywfeicbXPX6zdYjvMcyg1HRbitZ1vmEmduG8FOV jjaoX503l/Nvy128NFCrCbAktd7YXT8wp11YHwd1FSC4mMcASAD85eQlDBFFlz/avVfn yF+da8vSIFHDPBonN0E3/oiBn1olG6AUy82XXNygs5o4HKS0TDS2DvFSWBl6X2jH/HSA MOdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="byR/eekY"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il2-20020a17090b164200b00200919a55b4si15140466pjb.188.2022.09.13.13.00.16; Tue, 13 Sep 2022 13:00:31 -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=@gmail.com header.s=20210112 header.b="byR/eekY"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbiIMT7R (ORCPT + 99 others); Tue, 13 Sep 2022 15:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbiIMT6g (ORCPT ); Tue, 13 Sep 2022 15:58:36 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B64C874CE6; Tue, 13 Sep 2022 12:58:28 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id s9so7062214qkg.4; Tue, 13 Sep 2022 12:58:28 -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; bh=kefl6D8eKpN1GxKRqpPd+2PbW8yMD7NaxrgEOy2EJKU=; b=byR/eekYsW9DhH0NqLev2fS+tpkFMN+hxgB8j3wmXvKTocIMCm6zZesYvYgQ87wjhP q+4AfKw8TXxcj2+vnpVcn5ECPh4qGk7Jtzj+zNbyb6YCFLIiwPOzRUIUuAqm/vme1CGD HXFFRmWffOsc2lXoXpa+V0KHw2MwGlrFjaT+dLfIFP4Da4Lspw/3GTIWmZkSLzazc/cQ hUYdezyBusY92UGvKeXjT7Rg0vsemlXyaK6ln+reN6yeiO3uNu7F3nGVR2B+OsucHch6 d5MKRdQDkKjHro2ts06Z/prjBlf3W1AQZuN3IrXE7aLh74QN4KD+aUTWaAkLm41rgl56 mOWw== 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; bh=kefl6D8eKpN1GxKRqpPd+2PbW8yMD7NaxrgEOy2EJKU=; b=pxILh4RiPrkaLKWtwcO0Stiql600sgOP4HLqmk9oo8eEU9flyY8wE9iF6hahCeU4kU BgQrrntlmdJOTU0LWOqmn1MZ1o6/AhMI80fAkQZCq1SOXmIOxOrnLCUeSN/7BKjWrNKw L0+CNoG6rdkEn2CaBtz3TDYC3GyJMgIu57FUXe4vDWuqCle0fY/BLuCDJ9OggJOklSAD U2f2SPFlS5jzDtwEbShQgfxFCfFbhM8r8r0BfBM3W2y9IbjDyW37iEAsmCu8lkdqNy2f RUzvFwhFR/HQEDDGdJoESoFb+EzX+1cfFnsYrJhBxnvrZsL+BLZ+qSupdiVMsSN0YPfT Ruzw== X-Gm-Message-State: ACgBeo0+TIBXew2b9EwIELFX2rXqbBjea6U+B2Fcz+zZa1MrWuOlAEYA l5lhjXkWmfzpSCl7iUNeF8s= X-Received: by 2002:a37:916:0:b0:6ce:5f1c:d5d9 with SMTP id 22-20020a370916000000b006ce5f1cd5d9mr5678519qkj.737.1663099107720; Tue, 13 Sep 2022 12:58:27 -0700 (PDT) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id s11-20020a05620a29cb00b006b8e049cf08sm276305qkp.2.2022.09.13.12.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Sep 2022 12:58:27 -0700 (PDT) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Mike Kravetz , Muchun Song , Mike Rapoport , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Doug Berger , Florian Fainelli , David Hildenbrand , Zi Yan , Oscar Salvador , Hari Bathini , Kees Cook , - , KOSAKI Motohiro , Mel Gorman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux.dev Subject: [PATCH 09/21] mm/page_alloc: calculate node_spanned_pages from pfns Date: Tue, 13 Sep 2022 12:54:56 -0700 Message-Id: <20220913195508.3511038-10-opendmb@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220913195508.3511038-1-opendmb@gmail.com> References: <20220913195508.3511038-1-opendmb@gmail.com> 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,FREEMAIL_FROM, 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 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. Signed-off-by: Doug Berger --- mm/page_alloc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6bf76bbc0308..b6074961fb59 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7452,7 +7452,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 realtotalpages = 0; enum zone_type i; for (i = 0; i < MAX_NR_ZONES; i++) { @@ -7483,11 +7483,10 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat, zone->present_early_pages = real_size; #endif - totalpages += size; realtotalpages += real_size; } - pgdat->node_spanned_pages = totalpages; + pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; pgdat->node_present_pages = realtotalpages; pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); } -- 2.25.1