From d463576a25bf301625544eba23337232e36d3115 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Mon, 7 May 2012 17:16:47 -0700 Subject: [PATCH] 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 -- 2.46.0