From patchwork Tue Sep 13 19:54:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 12975317 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AD83C6FA82 for ; Tue, 13 Sep 2022 19:58:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14CC16B0087; Tue, 13 Sep 2022 15:58:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FD566B0088; Tue, 13 Sep 2022 15:58:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EECEA8D0001; Tue, 13 Sep 2022 15:58:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DA4526B0087 for ; Tue, 13 Sep 2022 15:58:28 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C194F1401D4 for ; Tue, 13 Sep 2022 19:58:28 +0000 (UTC) X-FDA: 79908124296.30.66E7888 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by imf01.hostedemail.com (Postfix) with ESMTP id 6CEC940092 for ; Tue, 13 Sep 2022 19:58:28 +0000 (UTC) Received: by mail-qk1-f179.google.com with SMTP id k12so9303218qkj.8 for ; 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=XWBs9jrsikDxrlA+06g0Gqs157xFM+NWDLEWbbkNpeB59TOwco/NcCExxPiAswN4cm 2vp1yQJ8sBKghhZRaCjXzHOfeA7jujxgCWaLQwSPIsPH4JraSmydAimgOt5eZtHhDtGn NhjZhDKLoAfGISGPo/eubHe+zoYmk+fwXOV2NUft7FKis+wjqf8w4xfUi8Za5skSq5SR xdrls4R9WsvrzBChSg449npGgnU3RQi4LYMh1Pa4ZSWEBvyPNUjMe+Va1V569gfl7ENu XIQV9zvXBhG4c65d9u4T+hWTXN/Nrdf+iCLtHD6GeZb45kP6gxwGJ1wCnnOdGuYwjKZM aKiw== X-Gm-Message-State: ACgBeo3N0NWqpO4ysk4h1QXQHjp+55aVz7hMwTFguju0qyMQqLwRmOdp Txctu0K9AFBJCFblfhbr0Uk= X-Google-Smtp-Source: AA6agR4kCtYZpwUOe+kdoRL5XUeDY9Udr6YA+L+RrDdkM+ZkGSBIa8BGCY7yWmaW8ey8FgVIise+hw== 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 ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="byR/eekY"; spf=pass (imf01.hostedemail.com: domain of opendmb@gmail.com designates 209.85.222.179 as permitted sender) smtp.mailfrom=opendmb@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663099108; a=rsa-sha256; cv=none; b=RxTBS5EyAG3tAQxLNO58O5F+fFHom96wS6etOvcbTZvKVzoSywnELGeAP137bGdnfSMmM1 vdczO6LXyPBs5iaEoKfUGk8BnCWiSPiBRHPAIM64PGhRTvZ/3mDbLskBghB6OCeWE/NVh4 XVRKw6vOwY1zxPIuAo3gmxSEiYI/1/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663099108; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kefl6D8eKpN1GxKRqpPd+2PbW8yMD7NaxrgEOy2EJKU=; b=YOGregR6ub1D6yX2PW5sbQ8aVPdb/Yxev4JEAbCxL0BW9+PBVu5H7KLwPdJsWirKfNa45y mcBQ1MRWJrruogUSaT2CpxMbIFly4TR2arZ07VYrherSSE9fVRegPKhOQQVX4o5xZaazPz 9xM7vO4v4wWOjxSx2ydwgoHGm8vKkXI= Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="byR/eekY"; spf=pass (imf01.hostedemail.com: domain of opendmb@gmail.com designates 209.85.222.179 as permitted sender) smtp.mailfrom=opendmb@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam12 X-Stat-Signature: 55kuzadwu8dg17y9m61i4eupahzh843f X-Rspamd-Queue-Id: 6CEC940092 X-Rspam-User: X-HE-Tag: 1663099108-874912 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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); }