diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-04-29 18:56:36 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-04-29 18:56:36 +0000 |
commit | bb1e0b257abb86c2b6efe470eaa92b65967e6d1d (patch) | |
tree | d3afeaf2fab32842769124475a7b5cfe88d8c20e /sys/vm/uma_int.h | |
parent | 76b17ed5dc6aeeda489462fbdbc682f224c84307 (diff) | |
download | FreeBSD-src-bb1e0b257abb86c2b6efe470eaa92b65967e6d1d.zip FreeBSD-src-bb1e0b257abb86c2b6efe470eaa92b65967e6d1d.tar.gz |
Modify UMA to use critical sections to protect per-CPU caches, rather than
mutexes, which offers lower overhead on both UP and SMP. When allocating
from or freeing to the per-cpu cache, without INVARIANTS enabled, we now
no longer perform any mutex operations, which offers a 1%-3% performance
improvement in a variety of micro-benchmarks. We rely on critical
sections to prevent (a) preemption resulting in reentrant access to UMA on
a single CPU, and (b) migration of the thread during access. In the event
we need to go back to the zone for a new bucket, we release the critical
section to acquire the global zone mutex, and must re-acquire the critical
section and re-evaluate which cache we are accessing in case migration has
occured, or circumstances have changed in the current cache.
Per-CPU cache statistics are now gathered lock-free by the sysctl, which
can result in small races in statistics reporting for caches.
Reviewed by: bmilekic, jeff (somewhat)
Tested by: rwatson, kris, gnn, scottl, mike at sentex dot net, others
Diffstat (limited to 'sys/vm/uma_int.h')
-rw-r--r-- | sys/vm/uma_int.h | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h index 9cf67cb..4d5ea7d 100644 --- a/sys/vm/uma_int.h +++ b/sys/vm/uma_int.h @@ -342,16 +342,6 @@ void uma_large_free(uma_slab_t slab); #define ZONE_LOCK(z) mtx_lock((z)->uz_lock) #define ZONE_UNLOCK(z) mtx_unlock((z)->uz_lock) -#define CPU_LOCK_INIT(cpu) \ - mtx_init(&uma_pcpu_mtx[(cpu)], "UMA pcpu", "UMA pcpu", \ - MTX_DEF | MTX_DUPOK) - -#define CPU_LOCK(cpu) \ - mtx_lock(&uma_pcpu_mtx[(cpu)]) - -#define CPU_UNLOCK(cpu) \ - mtx_unlock(&uma_pcpu_mtx[(cpu)]) - /* * Find a slab within a hash table. This is used for OFFPAGE zones to lookup * the slab structure. |