Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Feb 2021 15:51:56 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 17d0f830dddf - main - arm64: Include NUMA locality info in the CPU topology
Message-ID:  <202102181551.11IFputm074619@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=17d0f830dddf38724068f4139b6bef9a5dab70c5

commit 17d0f830dddf38724068f4139b6bef9a5dab70c5
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-02-18 15:50:57 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-02-18 15:51:38 +0000

    arm64: Include NUMA locality info in the CPU topology
    
    The scheduler uses this topology to try and preserve locality when
    migrating threads between CPUs and when performing work stealing.
    Ensure that on NUMA systems it will at least take the NUMA topology into
    account.
    
    Reviewed by:    mmel
    Submitted by:   Klara, Inc.
    Sponsored by:   Ampere Computing
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D28579
---
 sys/arm64/arm64/mp_machdep.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index 8f1118d36bf5..8d5d82879571 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -437,8 +437,35 @@ ipi_stop(void *dummy __unused)
 struct cpu_group *
 cpu_topo(void)
 {
+	struct cpu_group *dom, *root;
+	int i;
+
+	root = smp_topo_alloc(1);
+	dom = smp_topo_alloc(vm_ndomains);
+
+	root->cg_parent = NULL;
+	root->cg_child = dom;
+	CPU_COPY(&all_cpus, &root->cg_mask);
+	root->cg_count = mp_ncpus;
+	root->cg_children = vm_ndomains;
+	root->cg_level = CG_SHARE_NONE;
+	root->cg_flags = 0;
+
+	/*
+	 * Redundant layers will be collapsed by the caller so we don't need a
+	 * special case for a single domain.
+	 */
+	for (i = 0; i < vm_ndomains; i++, dom++) {
+		dom->cg_parent = root;
+		dom->cg_child = NULL;
+		CPU_COPY(&cpuset_domain[i], &dom->cg_mask);
+		dom->cg_count = CPU_COUNT(&dom->cg_mask);
+		dom->cg_children = 0;
+		dom->cg_level = CG_SHARE_L3;
+		dom->cg_flags = 0;
+	}
 
-	return (smp_topo_none());
+	return (root);
 }
 
 /* Determine if we running MP machine */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102181551.11IFputm074619>