aboutsummaryrefslogtreecommitdiff
path: root/sys/arm64/arm64/mp_machdep.c
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-02-18 15:50:57 +0000
committerMark Johnston <markj@FreeBSD.org>2021-02-18 15:51:38 +0000
commit17d0f830dddf38724068f4139b6bef9a5dab70c5 (patch)
tree57f559dea54a1960c2fcf92adc276b480e738b71 /sys/arm64/arm64/mp_machdep.c
parent8c280db0b4d22ad92152bf05f941201428c80b87 (diff)
downloadsrc-17d0f830dddf38724068f4139b6bef9a5dab70c5.tar.gz
src-17d0f830dddf38724068f4139b6bef9a5dab70c5.zip
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
Diffstat (limited to 'sys/arm64/arm64/mp_machdep.c')
-rw-r--r--sys/arm64/arm64/mp_machdep.c29
1 files changed, 28 insertions, 1 deletions
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 */