summaryrefslogtreecommitdiffstats
path: root/sys/vm/uma.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2013-04-08 19:10:45 +0000
committerglebius <glebius@FreeBSD.org>2013-04-08 19:10:45 +0000
commit7f9db020a246190e72c9b9656997403221c48a3a (patch)
treeaadd654864cd16caea405f5ff2772f2fcd665103 /sys/vm/uma.h
parent4312ec3f0dd92a3dedf58a28ebc6f4ae3a1a7672 (diff)
downloadFreeBSD-src-7f9db020a246190e72c9b9656997403221c48a3a.zip
FreeBSD-src-7f9db020a246190e72c9b9656997403221c48a3a.tar.gz
Merge from projects/counters: UMA_ZONE_PCPU zones.
These zones have slab size == sizeof(struct pcpu), but request from VM enough pages to fit (uk_slabsize * mp_ncpus). An item allocated from such zone would have a separate twin for each CPU in the system, and these twins are at a distance of sizeof(struct pcpu) from each other. This magic value of distance would allow us to make some optimizations later. To address private item from a CPU simple arithmetics should be used: item = (type *)((char *)base + sizeof(struct pcpu) * curcpu) These arithmetics are available as zpcpu_get() macro in pcpu.h. To introduce non-page size slabs a new field had been added to uma_keg uk_slabsize. This shifted some frequently used fields of uma_keg to the fourth cache line on amd64. To mitigate this pessimization, uma_keg fields were a bit rearranged and least frequently used uk_name and uk_link moved down to the fourth cache line. All other fields, that are dereferenced frequently fit into first three cache lines. Sponsored by: Nginx, Inc.
Diffstat (limited to 'sys/vm/uma.h')
-rw-r--r--sys/vm/uma.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
index 2569b88..b18693b 100644
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -252,6 +252,10 @@ int uma_zsecond_add(uma_zone_t zone, uma_zone_t master);
* Zone's pages will not be included in
* mini-dumps.
*/
+#define UMA_ZONE_PCPU 0x8000 /*
+ * Allocates mp_ncpus slabs sized to
+ * sizeof(struct pcpu).
+ */
/*
* These flags are shared between the keg and zone. In zones wishing to add
@@ -260,7 +264,7 @@ int uma_zsecond_add(uma_zone_t zone, uma_zone_t master);
*/
#define UMA_ZONE_INHERIT \
(UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \
- UMA_ZONE_HASH | UMA_ZONE_REFCNT | UMA_ZONE_VTOSLAB)
+ UMA_ZONE_HASH | UMA_ZONE_REFCNT | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU)
/* Definitions for align */
#define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */
OpenPOWER on IntegriCloud