]> git.openfabrics.org - ~shefty/librdmacm.git/commit
rsockets: Optimize synchronization to improve performance
authorSean Hefty <sean.hefty@intel.com>
Tue, 8 May 2012 00:16:47 +0000 (17:16 -0700)
committerSean Hefty <sean.hefty@intel.com>
Tue, 8 May 2012 00:16:47 +0000 (17:16 -0700)
commite20c2f4cc080f49661e1d5f745638105428f52c6
tree0a763ea65957b893b6af0eba1e31e6cc858869bd
parent5658ff385e0449a78a325d430163e524b7a97ec4
rsockets: Optimize synchronization to improve performance

Performance analysis using VTune showed that pthread_mutex_unlock()
is the single biggest contributor to increasing latency for 64-byte
transfers.  Unlocked was followed by get_sw_cqe(), then
__pthread_mutex_lock().  Replace the use of mutexes with an atomic
and a semaphore.  When there's no contention for the lock (which
would usually be the case when using nonblocking sockets), the
code simply increments and decrements an atomic varible.  Semaphores
are only used when contention occurs.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/cma.h
src/rsocket.c