summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_pcpu.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-03-04 14:46:30 +0000
committerglebius <glebius@FreeBSD.org>2014-03-04 14:46:30 +0000
commit8a9528c4d0ec97d5f0c55b27a51613851b619e04 (patch)
tree256bb459a422081d6ab540f11d785e1f0efa5449 /sys/kern/subr_pcpu.c
parentd06eb27738c9003bba69ae1f38b8b5addeb568dd (diff)
downloadFreeBSD-src-8a9528c4d0ec97d5f0c55b27a51613851b619e04.zip
FreeBSD-src-8a9528c4d0ec97d5f0c55b27a51613851b619e04.tar.gz
Merge r261722, r261723, r261724, r261725 from head:
several minor improvements for UMA_ZPCPU_ZONE zones.
Diffstat (limited to 'sys/kern/subr_pcpu.c')
-rw-r--r--sys/kern/subr_pcpu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/kern/subr_pcpu.c b/sys/kern/subr_pcpu.c
index 505a4df..a01f67a 100644
--- a/sys/kern/subr_pcpu.c
+++ b/sys/kern/subr_pcpu.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/sx.h>
+#include <vm/uma.h>
#include <ddb/ddb.h>
static MALLOC_DEFINE(M_PCPU, "Per-cpu", "Per-cpu resource accouting.");
@@ -127,6 +128,30 @@ dpcpu_startup(void *dummy __unused)
SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, 0);
/*
+ * UMA_PCPU_ZONE zones, that are available for all kernel
+ * consumers. Right now 64 bit zone is used for counter(9)
+ * and pointer zone is used by flowtable.
+ */
+
+uma_zone_t pcpu_zone_64;
+uma_zone_t pcpu_zone_ptr;
+
+static void
+pcpu_zones_startup(void)
+{
+
+ pcpu_zone_64 = uma_zcreate("64 pcpu", sizeof(uint64_t),
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
+
+ if (sizeof(uint64_t) == sizeof(void *))
+ pcpu_zone_ptr = pcpu_zone_64;
+ else
+ pcpu_zone_ptr = uma_zcreate("ptr pcpu", sizeof(void *),
+ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
+}
+SYSINIT(pcpu_zones, SI_SUB_KMEM, SI_ORDER_ANY, pcpu_zones_startup, NULL);
+
+/*
* First-fit extent based allocator for allocating space in the per-cpu
* region reserved for modules. This is only intended for use by the
* kernel linkers to place module linker sets.
OpenPOWER on IntegriCloud