summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2002-06-25 21:04:50 +0000
committerJeff Roberson <jeff@FreeBSD.org>2002-06-25 21:04:50 +0000
commit5c0e403ba253f06f1163667d16124aa066cb57cb (patch)
treed2c5b62109a0493d4b8baa6c84f3d23d757df146
parentf0b56c5c7e0ace605b88d5ec125589b02df94f9e (diff)
Notes
-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);
}