path: root/sys/sys/pcpu.h
diff options
authorMatt Macy <mmacy@FreeBSD.org>2018-07-06 02:06:03 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-07-06 02:06:03 +0000
commitab3059a8e7f382cff93dbe4d1b082adf62f4d849 (patch)
tree07b63f9da9282cc1b73ec6d51ce3988dbc08875f /sys/sys/pcpu.h
parent88171893e296f0c142cc7ee55db6244d2f6e76be (diff)
Back pcpu zone with domain correct pages
- Change pcpu zone consumers to use a stride size of PAGE_SIZE. (defined as UMA_PCPU_ALLOC_SIZE to make future identification easier) - Allocate page from the correct domain for a given cpu. - Don't initialize pc_domain to non-zero value if NUMA is not defined There are some misconceptions surrounding this field. It is the _VM_ NUMA domain and should only ever correspond to valid domain values as understood by the VM. The former slab size of sizeof(struct pcpu) was somewhat arbitrary. The new value is PAGE_SIZE because that's the smallest granularity which the VM can allocate a slab for a given domain. If you have fewer than PAGE_SIZE/8 counters on your system there will be some memory wasted, but this is obviously something where you want the cache line to be coming from the correct domain. Reviewed by: jeff Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15933
Notes: svn path=/head/; revision=336020
Diffstat (limited to 'sys/sys/pcpu.h')
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 127c10d6e110..9ba2adfdbff8 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -207,19 +207,21 @@ extern struct pcpu *cpuid_to_pcpu[];
#define curvidata PCPU_GET(vidata)
/* Accessor to elements allocated via UMA_ZONE_PCPU zone. */
static inline void *
zpcpu_get(void *base)
- return ((char *)(base) + sizeof(struct pcpu) * curcpu);
+ return ((char *)(base) + UMA_PCPU_ALLOC_SIZE * curcpu);
static inline void *
zpcpu_get_cpu(void *base, int cpu)
- return ((char *)(base) + sizeof(struct pcpu) * cpu);
+ return ((char *)(base) + UMA_PCPU_ALLOC_SIZE * cpu);