]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads: inline the wait function for pthread_rwlock emulation
authorWilly Tarreau <w@1wt.eu>
Wed, 16 Aug 2023 20:51:37 +0000 (22:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Aug 2023 22:09:05 +0000 (00:09 +0200)
When using pthread_rwlock emulation, contention is reported on
pl_wait_unlock_long(). This is really not convenient to analyse what is
happening. Now plock supports inlining the wait call for just the lorw
functions by enabling PLOCK_LORW_INLINE_WAIT. Let's do this so that now
the wait time will be precisely reported as either pthread_rwlock_rdlock()
or pthread_rwlock_wrlock() depending on the contended function, but no
more on pl_wait_unlock_long(), which will still be reported for all
other locks.

include/haproxy/thread.h

index 30ff7827a0c67e25bb6b4f9b54930e7f352e5a9c..471f59e3b23e376edc11c1e905613a532da61390 100644 (file)
@@ -167,6 +167,7 @@ static inline unsigned long long ha_get_pthread_id(unsigned int thr)
 
 /********************** THREADS ENABLED ************************/
 
+#define PLOCK_LORW_INLINE_WAIT
 #include <import/plock.h>
 
 void thread_harmless_till_end(void);