summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/uma_core.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 898f5071d660..5aa9b8b8fc20 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -733,15 +733,11 @@ slab_zalloc(uma_zone_t zone, int wait)
mem = tmps->us_data;
}
- ZONE_LOCK(zone);
-
- /* Alloc slab structure for offpage, otherwise adjust it's position */
+ /* Point the slab into the allocated memory */
if (!(zone->uz_flags & UMA_ZFLAG_OFFPAGE)) {
slab = (uma_slab_t )(mem + zone->uz_pgoff);
- } else {
- if (!(zone->uz_flags & UMA_ZFLAG_MALLOC))
- UMA_HASH_INSERT(&zone->uz_hash, slab, mem);
}
+
if (zone->uz_flags & UMA_ZFLAG_MALLOC) {
#ifdef UMA_DEBUG
printf("Inserting %p into malloc hash from slab %p\n",
@@ -782,10 +778,16 @@ slab_zalloc(uma_zone_t zone, int wait)
for (i = 0; i < zone->uz_ipers; i++)
zone->uz_init(slab->us_data + (zone->uz_rsize * i),
zone->uz_size);
+ ZONE_LOCK(zone);
+
+ if ((zone->uz_flags & (UMA_ZFLAG_OFFPAGE|UMA_ZFLAG_MALLOC)) ==
+ UMA_ZFLAG_OFFPAGE)
+ UMA_HASH_INSERT(&zone->uz_hash, slab, mem);
zone->uz_pages += zone->uz_ppera;
zone->uz_free += zone->uz_ipers;
+
return (slab);
}