Skip to content
Snippets Groups Projects
  • Tomasz Grabiec's avatar
    2e0c30f4
    Make BSD code use hardware atomics · 2e0c30f4
    Tomasz Grabiec authored
    
    Currently we use implementation from
    bsd/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
    which is using global mutex.
    
    This showes up on wait profile of ZFS writes:
    
    (...)
       \-- 469.96 us (0.00%, #250) arc_do_user_evicts
           \-- 469.96 us (0.00%, #250) dbuf_do_evict
               |-- 355.93 us (0.00%, #154) dbuf_destroy
    (...)
               |   \-- 76.60 us (0.00%, #53) zrl_add
               |                             atomic_cas_32
               |                             lockfree_mutex_lock
               |                             sched::thread::wait()
               |
               |-- 66.14 us (0.00%, #56) dbuf_clear
               |                         zrl_add
               |                         atomic_cas_32
               |                         lockfree_mutex_lock
               |                         sched::thread::wait()
               |
               \-- 47.89 us (0.00%, #40) dbuf_rele_and_unlock
                                         atomic_add_64_nv
                                         lockfree_mutex_lock
                                         sched::thread::wait()
    
    This patch switches to amd64 implementation.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    2e0c30f4
    History
    Make BSD code use hardware atomics
    Tomasz Grabiec authored
    
    Currently we use implementation from
    bsd/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
    which is using global mutex.
    
    This showes up on wait profile of ZFS writes:
    
    (...)
       \-- 469.96 us (0.00%, #250) arc_do_user_evicts
           \-- 469.96 us (0.00%, #250) dbuf_do_evict
               |-- 355.93 us (0.00%, #154) dbuf_destroy
    (...)
               |   \-- 76.60 us (0.00%, #53) zrl_add
               |                             atomic_cas_32
               |                             lockfree_mutex_lock
               |                             sched::thread::wait()
               |
               |-- 66.14 us (0.00%, #56) dbuf_clear
               |                         zrl_add
               |                         atomic_cas_32
               |                         lockfree_mutex_lock
               |                         sched::thread::wait()
               |
               \-- 47.89 us (0.00%, #40) dbuf_rele_and_unlock
                                         atomic_add_64_nv
                                         lockfree_mutex_lock
                                         sched::thread::wait()
    
    This patch switches to amd64 implementation.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>