From patchwork Sat Mar 11 00:38:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 13170539 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 94B69C6FA99 for ; Sat, 11 Mar 2023 00:39:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1EA0E8E0003; Fri, 10 Mar 2023 19:39:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C0846B0074; Fri, 10 Mar 2023 19:39:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 088C18E0003; Fri, 10 Mar 2023 19:39:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E9D4D6B0072 for ; Fri, 10 Mar 2023 19:39:53 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C11D2AAE4E for ; Sat, 11 Mar 2023 00:39:53 +0000 (UTC) X-FDA: 80554759866.21.632F2D3 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf30.hostedemail.com (Postfix) with ESMTP id CDE7380008 for ; Sat, 11 Mar 2023 00:39:51 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=H0fDFIKr; spf=pass (imf30.hostedemail.com: domain of opendmb@gmail.com designates 209.85.160.174 as permitted sender) smtp.mailfrom=opendmb@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678495191; 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=21XWFqZKFhrw7IqRe7YpT4TCzw//2tpfFn1az0nze7A=; b=qpTQf4w72MfiKt05nGwZ9WGiaGDEDBOGsbRN+Tkh/sb1rr5ez1nHyJow66E7R9Qv1bYWRp qN7zDM9/cAn96tA7r2yWMcxu3mK5fuuintKYx2a4Kp+B3/aMjs3qrbVG0nyiCyw1FRQ8q2 wHY0kk4OUPPwSUJOeo0sg7kf/h6PbXY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=H0fDFIKr; spf=pass (imf30.hostedemail.com: domain of opendmb@gmail.com designates 209.85.160.174 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=1678495191; a=rsa-sha256; cv=none; b=4DHudC/yw7r3/schEtUo02jZqoNu27rW+iZaHk+2lHrhShB55aunafSYoZQURaNOQZzgJN Jx2q8EY8tKhjG7qgBJ1vStn9wSLvfebPbXO4Esfbne/W/4bWCOUdJSwVLFhmDARf3HgStO PKUcmral2wcnEtroGrRA0B5DAaAcZFQ= Received: by mail-qt1-f174.google.com with SMTP id cf14so7703709qtb.10 for ; Fri, 10 Mar 2023 16:39:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678495191; 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=21XWFqZKFhrw7IqRe7YpT4TCzw//2tpfFn1az0nze7A=; b=H0fDFIKrE+i4ootQK/33BZNQZIOFe5T2gXr49E41EzK7+v+nPMZu5ce7GQgvufox1r xofMSL1BtQS45kz/SyzPCOerPL6qsYRi0a6twooP6fAdZu2ZRX08kGWmrLZ7Z0zZSTZP q+UEKBCQTwBEJR6r7gXIwUeRd0wTaMWuxQ3AU3IKjs4i6DE3h4QiwCXwnyrg4hJfR9Fa OqS3WXoZcjVB0XhOmr7mqX1611c4J16sjcN1h+t7gR00matvjm9r+0NLXtlYAE//yMF/ M0fUUbTDdeXlerycqwdx/xfIlphKCqHxxm1rGe7SLvvTxgx6cxy15SvFrAbj2TA/Q5VH y60A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678495191; 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=21XWFqZKFhrw7IqRe7YpT4TCzw//2tpfFn1az0nze7A=; b=RM249FxqSoBGgV89524FYIO7FdIErhtAaqrvn/CY3PoiSUdWvm3dcGxhpiJ/dd/G1s 0PfGOKQpx0/Ux91UIfJCIKFXbDpcFMMBg44KgwfHUZjVdDq6yttJ5LGUwjCs57iLEKRY oAv8g8hsvVX6q7uFxuEsYKHmfmimE/PeZatz6j4EpF+Q371SWtocC3+5BTma206K33to Q1YK52Dk46etVSjntcaPiWDBF6wUsxnbFDgUlebLemRx2d5+ovr4oKo6deOqi4wq7oqu ZhaKnex9mnjC8wiE2W1yQ+fcNuDL+JhS31nbiRKBtDVVhshVTpswRqUui6NuwaxIZaAY /2ZQ== X-Gm-Message-State: AO0yUKVqAOaSZohfU2mJhg8a8snm+iJ7kuVkrcBbO1v++/2+1RFiYXPY ALMvUWzwSeA5L6hcAvnAfeY= X-Google-Smtp-Source: AK7set+uqKakBULmDoJ5Xr6lerX7tivt8yOC0pEZoZHG6hVLZ77mTu5fc8Qx1J0t8jZ7dQbCVw6tHQ== X-Received: by 2002:ac8:5ad5:0:b0:3bf:a3fc:c70a with SMTP id d21-20020ac85ad5000000b003bfa3fcc70amr46750078qtd.28.1678495191044; Fri, 10 Mar 2023 16:39:51 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a5-20020ac84345000000b003bfaff2a6b9sm868874qtn.10.2023.03.10.16.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 16:39:50 -0800 (PST) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Mike Rapoport , Borislav Petkov , "Paul E. McKenney" , Randy Dunlap , Neeraj Upadhyay , Damien Le Moal , Kim Phillips , "Steven Rostedt (Google)" , Michal Hocko , Johannes Weiner , Vlastimil Babka , KOSAKI Motohiro , Mel Gorman , Muchun Song , Mike Kravetz , Florian Fainelli , David Hildenbrand , Oscar Salvador , Joonsoo Kim , Sukadev Bhattiprolu , Rik van Riel , Roman Gushchin , Minchan Kim , Chris Goldsworthy , "Georgi Djakov" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Doug Berger Subject: [PATCH v4 2/9] mm/page_alloc: calculate node_spanned_pages from pfns Date: Fri, 10 Mar 2023 16:38:48 -0800 Message-Id: <20230311003855.645684-3-opendmb@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230311003855.645684-1-opendmb@gmail.com> References: <20230311003855.645684-1-opendmb@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CDE7380008 X-Stat-Signature: nr9847dpjo4dfw34dok45tbwq75jihzq X-Rspam-User: X-HE-Tag: 1678495191-651878 X-HE-Meta: U2FsdGVkX18PuSPNZ0AieqeTmXmKIXhqoause/MVovlJH/WFSvsbiuQsoL6soU3gFazrWpPc9e1g/dwK03lqacKpgXbAtvybt9QL7gSZ40YqIgP9/U273nWDyh8PiQWI9rhnkWwubQDVTiBBGn2KUO5X88YO64JlVrxongEKdu2wbDCeuwgAWIwNxdDxKYWovvJzTMN77qyvtIqnkwO1olz71tnms+boSNzPbmQBBh/y4n/PjKYCTp989VQgGx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nb8GaySP44H7yQXQ1VvT3F7CUL6cNk3MaTfuXPe+Gv+hf1fFvXzUs7F0fShQ7tT67dFBDhuLCoMDoWlfhSPKQLCxW+lnyFNDvbM65+3yniByxvkvSpuAhYMmiv550VAMYgjeOKpOYb9oiLG0tKEQZmpEXD3MVRNdYpfOoMRcryJVO2HuC4V0ZSAwm/mzWKcxHAARiFcX8vjPgK0gtgs7FQZs69s6H9tcsBjVXeE5MA6kJmXrKthHVk/FEJhuvtJSQPZxg65pIqUe+b0NH6wkcEBKOLec= 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. 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 ac1fc986af44..b1952f86ab6d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7586,7 +7586,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++) { @@ -7617,13 +7617,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