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
This commit is contained in:
Mark Johnston 2021-02-18 10:50:57 -05:00
parent 8c280db0b4
commit 17d0f830dd

View File

@ -437,8 +437,35 @@ ipi_stop(void *dummy __unused)
struct cpu_group *
cpu_topo(void)
{
struct cpu_group *dom, *root;
int i;
return (smp_topo_none());
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 (root);
}
/* Determine if we running MP machine */