aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_radix.c
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2013-04-18 05:34:33 +0000
committerAlan Cox <alc@FreeBSD.org>2013-04-18 05:34:33 +0000
commit880659fe819832bf064cf63dba0aae34f83a659e (patch)
tree520d396b7993ef86ab8915049785f4b9b47a3e56 /sys/vm/vm_radix.c
parentacad2b1e226f8fd3cf8252f5997aba94875c5cbc (diff)
downloadsrc-880659fe819832bf064cf63dba0aae34f83a659e.tar.gz
src-880659fe819832bf064cf63dba0aae34f83a659e.zip
When calculating the number of reserved nodes, discount the pages that will
be used to store the nodes. Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=249605
Diffstat (limited to 'sys/vm/vm_radix.c')
-rw-r--r--sys/vm/vm_radix.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/vm/vm_radix.c b/sys/vm/vm_radix.c
index 30869de29e42..970bc66fbda4 100644
--- a/sys/vm/vm_radix.c
+++ b/sys/vm/vm_radix.c
@@ -360,10 +360,17 @@ vm_radix_node_zone_init(void *mem, int size __unused, int flags __unused)
static void
vm_radix_prealloc(void *arg __unused)
{
+ int nodes;
- if (!uma_zone_reserve_kva(vm_radix_node_zone, cnt.v_page_count))
+ /*
+ * Calculate the number of reserved nodes, discounting the pages that
+ * are needed to store them.
+ */
+ nodes = ((vm_paddr_t)cnt.v_page_count * PAGE_SIZE) / (PAGE_SIZE +
+ sizeof(struct vm_radix_node));
+ if (!uma_zone_reserve_kva(vm_radix_node_zone, nodes))
panic("%s: unable to create new zone", __func__);
- uma_prealloc(vm_radix_node_zone, cnt.v_page_count);
+ uma_prealloc(vm_radix_node_zone, nodes);
}
SYSINIT(vm_radix_prealloc, SI_SUB_KMEM, SI_ORDER_SECOND, vm_radix_prealloc,
NULL);