diff options
author | jeff <jeff@FreeBSD.org> | 2002-06-25 21:04:50 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-06-25 21:04:50 +0000 |
commit | e9c6c8e0fd0524a17ece1b6f788a73d3de264304 (patch) | |
tree | d2c5b62109a0493d4b8baa6c84f3d23d757df146 /sys/vm | |
parent | 513df53f599143b8e6eea0bfc146795e8b49a816 (diff) | |
download | FreeBSD-src-e9c6c8e0fd0524a17ece1b6f788a73d3de264304.zip FreeBSD-src-e9c6c8e0fd0524a17ece1b6f788a73d3de264304.tar.gz |
Reduce the amount of code that runs with the zone lock held in slab_zalloc().
This allows us to run the zone initialization functions without any locks held.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/uma_core.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 898f507..5aa9b8b 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); } |