From 66dcc0550eef8401e44078fbf01f8a2cb5960b90 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 16 Aug 2023 22:29:45 +0200 Subject: [PATCH] IMPORT: plock: always expose the inline version of the lock wait function Doing so will allow to expose the time spent in certain highly contended functions, which can be desirable for more accurate CPU profiling. For example this could be done in locking functions that are already not inlined so that they are the ones being reported as those consuming the CPU instead of just pl_wait_unlock_long(). This is plock upstream commit 7505c2e2c8c4aa0ab8f52a2288e1334ae6412be4. --- include/import/plock.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/include/import/plock.h b/include/import/plock.h index 1345e958a..07350009f 100644 --- a/include/import/plock.h +++ b/include/import/plock.h @@ -75,12 +75,8 @@ _r; /* return value */ \ }) #else /* not PLOCK_DISABLE_EBO */ -# if defined(PLOCK_INLINE_EBO) __attribute__((unused,always_inline,no_instrument_function)) inline -# else -__attribute__((unused,noinline,no_instrument_function)) -# endif -static unsigned long pl_wait_unlock_long(const unsigned long *lock, const unsigned long mask) +static unsigned long __pl_wait_unlock_long(const unsigned long *lock, const unsigned long mask) { unsigned long ret; unsigned int m = 0; @@ -113,6 +109,16 @@ static unsigned long pl_wait_unlock_long(const unsigned long *lock, const unsign return ret; } + +# if defined(PLOCK_INLINE_EBO) +__attribute__((unused,always_inline,no_instrument_function)) inline +# else +__attribute__((unused,noinline,no_instrument_function)) +# endif +static unsigned long pl_wait_unlock_long(const unsigned long *lock, const unsigned long mask) +{ + return __pl_wait_unlock_long(lock, mask); +} #endif /* PLOCK_DISABLE_EBO */ /* This function waits for to release all bits covered by , and @@ -138,12 +144,8 @@ static unsigned long pl_wait_unlock_long(const unsigned long *lock, const unsign _r; /* return value */ \ }) #else -# if defined(PLOCK_INLINE_EBO) __attribute__((unused,always_inline,no_instrument_function)) inline -# else -__attribute__((unused,noinline,no_instrument_function)) -# endif -static unsigned int pl_wait_unlock_int(const unsigned int *lock, const unsigned int mask) +static unsigned int __pl_wait_unlock_int(const unsigned int *lock, const unsigned int mask) { unsigned int ret; unsigned int m = 0; @@ -176,6 +178,16 @@ static unsigned int pl_wait_unlock_int(const unsigned int *lock, const unsigned return ret; } + +# if defined(PLOCK_INLINE_EBO) +__attribute__((unused,always_inline,no_instrument_function)) inline +# else +__attribute__((unused,noinline,no_instrument_function)) +# endif +static unsigned int pl_wait_unlock_int(const unsigned int *lock, const unsigned int mask) +{ + return __pl_wait_unlock_int(lock, mask); +} #endif /* PLOCK_DISABLE_EBO */ /* This function waits for to change from value and returns the