powerpc: Allocate DPCPU block from domain-local memory

This should improve NUMA scalability a little, by binding to the CPU's NUMA
domain.  This matches what's done on amd64.
This commit is contained in:
Justin Hibbits 2019-09-25 01:23:08 +00:00
parent 087d0e0b5e
commit 0cfa351ec5

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/ktr.h>
#include <sys/bus.h>
#include <sys/cpuset.h>
#include <sys/domainset.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
@ -149,7 +150,7 @@ cpu_mp_start(void)
{
struct cpuref bsp, cpu;
struct pcpu *pc;
int error;
int domain, error;
error = platform_smp_get_bsp(&bsp);
KASSERT(error == 0, ("Don't know BSP"));
@ -166,12 +167,18 @@ cpu_mp_start(void)
cpu.cr_cpuid);
goto next;
}
if (vm_ndomains > 1)
domain = cpu.cr_domain;
else
domain = 0;
if (cpu.cr_cpuid != bsp.cr_cpuid) {
void *dpcpu;
pc = &__pcpu[cpu.cr_cpuid];
dpcpu = (void *)kmem_malloc(DPCPU_SIZE, M_WAITOK |
M_ZERO);
dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain),
DPCPU_SIZE, M_WAITOK | M_ZERO);
pcpu_init(pc, cpu.cr_cpuid, sizeof(*pc));
dpcpu_init(dpcpu, cpu.cr_cpuid);
} else {
@ -179,13 +186,9 @@ cpu_mp_start(void)
pc->pc_cpuid = bsp.cr_cpuid;
pc->pc_bsp = 1;
}
pc->pc_domain = domain;
pc->pc_hwref = cpu.cr_hwref;
if (vm_ndomains > 1)
pc->pc_domain = cpu.cr_domain;
else
pc->pc_domain = 0;
CPU_SET(pc->pc_cpuid, &cpuset_domain[pc->pc_domain]);
KASSERT(pc->pc_domain < MAXMEMDOM, ("bad domain value %d\n",
pc->pc_domain));