summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2013-03-17 16:49:37 +0000
committeralc <alc@FreeBSD.org>2013-03-17 16:49:37 +0000
commit8a01505f5e18b990ce2f528a0b4c69b542d976fa (patch)
tree63873d891b7406e1009c938323ddf7be8b0a453c /sys/vm
parent9e48bd7ba9216c10792b9ae08750e8482663e32c (diff)
downloadFreeBSD-src-8a01505f5e18b990ce2f528a0b4c69b542d976fa.zip
FreeBSD-src-8a01505f5e18b990ce2f528a0b4c69b542d976fa.tar.gz
The M_ZERO can be eliminated from the uma_zalloc() call in
vm_radix_node_get() with a small change to vm_radix_reclaim_allnodes_int(). This change further reduced the average number of cycles per vm_page_insert() call from 532 to 519. Reviewed by: attilio Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_radix.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/vm/vm_radix.c b/sys/vm/vm_radix.c
index 0d7fcc6..c0c474e 100644
--- a/sys/vm/vm_radix.c
+++ b/sys/vm/vm_radix.c
@@ -110,7 +110,7 @@ vm_radix_node_get(vm_pindex_t owner, uint16_t count, uint16_t clevel)
{
struct vm_radix_node *rnode;
- rnode = uma_zalloc(vm_radix_node_zone, M_NOWAIT | M_ZERO);
+ rnode = uma_zalloc(vm_radix_node_zone, M_NOWAIT);
/*
* The required number of nodes should already be pre-allocated
@@ -314,6 +314,7 @@ vm_radix_reclaim_allnodes_int(struct vm_radix_node *rnode)
continue;
if (vm_radix_node_page(rnode->rn_child[slot]) == NULL)
vm_radix_reclaim_allnodes_int(rnode->rn_child[slot]);
+ rnode->rn_child[slot] = NULL;
rnode->rn_count--;
}
vm_radix_node_put(rnode);
@@ -327,15 +328,32 @@ static void
vm_radix_node_zone_dtor(void *mem, int size __unused, void *arg __unused)
{
struct vm_radix_node *rnode;
+ int slot;
rnode = mem;
KASSERT(rnode->rn_count == 0,
- ("vm_radix_node_put: Freeing node %p with %d children\n", mem,
+ ("vm_radix_node_put: rnode %p has %d children", rnode,
rnode->rn_count));
+ for (slot = 0; slot < VM_RADIX_COUNT; slot++)
+ KASSERT(rnode->rn_child[slot] == NULL,
+ ("vm_radix_node_put: rnode %p has a child", rnode));
}
#endif
/*
+ * Radix node zone initializer.
+ */
+static int
+vm_radix_node_zone_init(void *mem, int size __unused, int flags __unused)
+{
+ struct vm_radix_node *rnode;
+
+ rnode = mem;
+ memset(rnode->rn_child, 0, sizeof(rnode->rn_child));
+ return (0);
+}
+
+/*
* Pre-allocate intermediate nodes from the UMA slab zone.
*/
static void
@@ -365,7 +383,8 @@ vm_radix_init(void)
#else
NULL,
#endif
- NULL, NULL, VM_RADIX_PAD, UMA_ZONE_VM | UMA_ZONE_NOFREE);
+ vm_radix_node_zone_init, NULL, VM_RADIX_PAD, UMA_ZONE_VM |
+ UMA_ZONE_NOFREE);
}
/*
OpenPOWER on IntegriCloud