]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
IMPORT: plock: always expose the inline version of the lock wait function
authorWilly Tarreau <w@1wt.eu>
Wed, 16 Aug 2023 20:29:45 +0000 (22:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Aug 2023 22:09:05 +0000 (00:09 +0200)
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

index 1345e958a4ffef1d2125717934f574d6720d7d7e..07350009f8b273c444648929df56a2d6f5efaa69 100644 (file)
                _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 <lock> to release all bits covered by <mask>, 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 <lock> to change from value <prev> and returns the