[PATCH 2/2] kvm: optimize out smp_mb after srcu_read_unlock

2013-11-04 Thread Michael S. Tsirkin
I noticed that srcu_read_lock/unlock both have a memory barrier, so just by moving srcu_read_unlock earlier we can get rid of one call to smp_mb() using smp_mb__after_srcu_read_unlock instead. Unsurprisingly, the gain is small but measureable using the unit test microbenchmark: before

[PATCH 2/2] kvm: optimize out smp_mb after srcu_read_unlock

2013-11-04 Thread Michael S. Tsirkin
I noticed that srcu_read_lock/unlock both have a memory barrier, so just by moving srcu_read_unlock earlier we can get rid of one call to smp_mb() using smp_mb__after_srcu_read_unlock instead. Unsurprisingly, the gain is small but measureable using the unit test microbenchmark: before