From: Willy Tarreau Date: Wed, 16 Aug 2023 20:51:37 +0000 (+0200) Subject: MINOR: threads: inline the wait function for pthread_rwlock emulation X-Git-Tag: v2.9-dev4~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=071d689a514dac522ac3654f53bc22214b5716d0;p=thirdparty%2Fhaproxy.git MINOR: threads: inline the wait function for pthread_rwlock emulation 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. --- diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index 30ff7827a0..471f59e3b2 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -167,6 +167,7 @@ static inline unsigned long long ha_get_pthread_id(unsigned int thr) /********************** THREADS ENABLED ************************/ +#define PLOCK_LORW_INLINE_WAIT #include void thread_harmless_till_end(void);