Skip to contentSkip to conversation

sched/numa: Fix NUMA_DIRECT topology identification

PATCH In review Aravind Gopalakrishnan 3 participants 3 messages Aug 11, 2015 – Aug 12, 2015 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/numa: Fix NUMA_DIRECT topology identification

Systems which have all nodes at a distance of at most 1 hop should be identified as 'NUMA_DIRECT'.

However, the scheduler incorrectly identifies it as 'NUMA_BACKPLANE'. This is because 'n' is assigned to sched_max_numa_distance but the code (mis)interprets it to mean 'number of hops'.

Rik had actually used sched_domains_numa_levels for detecting a 'NUMA_DIRECT' topology-
http://marc.info/?l=linux-kernel&m=141279712429834&w=2

But that was changed when he removed the hops table in the subsequent version-
http://marc.info/?l=linux-kernel&m=141353106106771&w=2

Fixing the issue here.

---
 kernel/sched/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/sched/core.c +3 -1
index 655557d..e51739e 100644
@@ -6442,8 +6442,10 @@ static void init_numa_topology_type(void)
 
 	n = sched_max_numa_distance;
 
-	if (n <= 1)
+	if (sched_domains_numa_levels <= 1) {
 		sched_numa_topology_type = NUMA_DIRECT;
+		return;
+	}
 
 	for_each_online_node(a) {
 		for_each_online_node(b) {
Signature · 1 line
2.4.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Aravind Gopalakrishnan

Systems which have all nodes at a distance of at most 1 hop should be identified as 'NUMA_DIRECT'.

However, the scheduler incorrectly identifies it as 'NUMA_BACKPLANE'. This is because 'n' is assigned to sched_max_numa_distance but the code (mis)interprets it to mean 'number of hops'.

Quoted 7 lines

Rik had actually used sched_domains_numa_levels for detecting a 'NUMA_DIRECT' topology-
http://marc.info/?l=linux-kernel&m=141279712429834&w=2

But that was changed when he removed the hops table in the subsequent version-
http://marc.info/?l=linux-kernel&m=141353106106771&w=2

Good catch! Thank you!

Quoted 3 lines

Fixing the issue here.

Signature · 1 line
All rights reversed
#2 lore raw
In reply to Aravind Gopalakrishnan
sched/numa: Fix NUMA_DIRECT topology identification
Commit-ID:  e237882b8f83dd1a0eece1608bcb689d4f4b221b
Gitweb:     http://git.kernel.org/tip/e237882b8f83dd1a0eece1608bcb689d4f4b221b
Author:     Aravind Gopalakrishnan <[email protected]>
AuthorDate: Mon, 10 Aug 2015 20:20:48 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 12 Aug 2015 12:06:08 +0200

sched/numa: Fix NUMA_DIRECT topology identification

Systems which have all nodes at a distance of at most 1 hop should be identified as 'NUMA_DIRECT'.

However, the scheduler incorrectly identifies it as 'NUMA_BACKPLANE'. This is because 'n' is assigned to sched_max_numa_distance but the code (mis)interprets it to mean 'number of hops'.

Rik had actually used sched_domains_numa_levels for detecting a 'NUMA_DIRECT' topology:

http://marc.info/?l=linux-kernel&m=141279712429834&w=2

But that was changed when he removed the hops table in the subsequent version:

http://marc.info/?l=linux-kernel&m=141353106106771&w=2

Fixing the issue here.

---
 kernel/sched/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/sched/core.c +3 -1
index b11f624..ea6d743 100644
@@ -6444,8 +6444,10 @@ static void init_numa_topology_type(void)
 
 	n = sched_max_numa_distance;
 
-	if (n <= 1)
+	if (sched_domains_numa_levels <= 1) {
 		sched_numa_topology_type = NUMA_DIRECT;
+		return;
+	}
 
 	for_each_online_node(a) {
 		for_each_online_node(b) {