From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Mel Gorman <mgorman@techsingularity.net>,
Rik van Riel <riel@surriel.com>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Valentin Schneider <valentin.schneider@arm.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
linuxppc-dev@lists.ozlabs.org,
Nathan Lynch <nathanl@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Scott Cheloha <cheloha@linux.ibm.com>,
Gautham R Shenoy <ego@linux.vnet.ibm.com>,
Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
Subject: [PATCH 2/3] powerpc/numa: Populate distance map correctly
Date: Thu, 20 May 2021 21:14:26 +0530 [thread overview]
Message-ID: <20210520154427.1041031-3-srikar@linux.vnet.ibm.com> (raw)
In-Reply-To: <20210520154427.1041031-1-srikar@linux.vnet.ibm.com>
As per PAPR that defines the OS to hypervisor interface on POWER,
there is no way to calculate the node_distance between 2 nodes, when
either of the nodes are offline. However scheduler needs the distance
map to be populated at boot time. On POWER, this information is
provided within the distance_ref_points_depth array, which needs to be
parsed to extract the potential node distances.
To handle this scenario, lets overload arch_populate_distance_map(),
to provide all the distances that are possible in the current
platform.
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Scott Cheloha <cheloha@linux.ibm.com>
Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
Reported-by: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/topology.h | 3 +++
arch/powerpc/mm/numa.c | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index e4db64c0e184..d7605d833b8d 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -22,6 +22,9 @@ struct drmem_lmb;
cpu_all_mask : \
node_to_cpumask_map[node])
+#define arch_populate_distance_map arch_populate_distance_map
+extern int arch_populate_distance_map(unsigned long *distance_map);
+
struct pci_bus;
#ifdef CONFIG_PCI
extern int pcibus_to_node(struct pci_bus *bus);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f2bf98bdcea2..9a225b29814a 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -221,6 +221,25 @@ static void initialize_distance_lookup_table(int nid,
}
}
+int arch_populate_distance_map(unsigned long *distance_map)
+{
+ int i;
+ int distance = LOCAL_DISTANCE;
+
+ bitmap_set(distance_map, distance, 1);
+
+ if (!form1_affinity) {
+ bitmap_set(distance_map, REMOTE_DISTANCE, 1);
+ return 0;
+ }
+
+ for (i = 0; i < distance_ref_points_depth; i++) {
+ distance *= 2;
+ bitmap_set(distance_map, distance, 1);
+ }
+ return 0;
+}
+
/*
* Returns nid in the range [0..nr_node_ids], or -1 if no useful NUMA
* info is found.
--
2.27.0
next prev parent reply other threads:[~2021-05-20 15:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-20 15:44 [PATCH 0/3] Skip numa distance for offline nodes Srikar Dronamraju
2021-05-20 15:44 ` [PATCH 1/3] sched/topology: Allow archs to populate distance map Srikar Dronamraju
2021-05-20 18:56 ` Peter Zijlstra
2021-05-21 2:38 ` Srikar Dronamraju
2021-05-21 8:14 ` Peter Zijlstra
2021-05-21 9:28 ` Srikar Dronamraju
2021-05-24 14:16 ` Valentin Schneider
2021-05-24 16:18 ` Srikar Dronamraju
2021-05-25 10:21 ` Valentin Schneider
2021-05-25 11:32 ` Srikar Dronamraju
2021-05-28 5:21 ` Srikar Dronamraju
2021-05-28 8:43 ` Peter Zijlstra
2021-05-28 10:24 ` Srikar Dronamraju
2021-05-20 15:44 ` Srikar Dronamraju [this message]
2021-05-24 14:16 ` [PATCH 2/3] powerpc/numa: Populate distance map correctly Valentin Schneider
2021-05-24 14:50 ` Srikar Dronamraju
2021-05-20 15:44 ` [PATCH 3/3] sched/topology: Skip updating masks for non-online nodes Srikar Dronamraju
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210520154427.1041031-3-srikar@linux.vnet.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=Geetika.Moolchandani1@ibm.com \
--cc=cheloha@linux.ibm.com \
--cc=dietmar.eggemann@arm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mgorman@techsingularity.net \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=nathanl@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=tglx@linutronix.de \
--cc=valentin.schneider@arm.com \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).