[lttng-dev] [PATCH lttng-ust 2/2] Fix: cache the result of getpid() internally

Michael Jeanson mjeanson at efficios.com
Fri Mar 2 17:36:26 EST 2018


On Linux we called getpid() directly on each tracepoint and relied on
the glibc pid cache. However, in glibc 2.25, released on 2017-02-05, the
pid cache was removed which results in a getpid syscall on each event
when the vpid context is enabled.

Remove the Linux specific case and use our internal cache all the time.

Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 liblttng-ust/lttng-context-vpid.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/liblttng-ust/lttng-context-vpid.c b/liblttng-ust/lttng-context-vpid.c
index 5e5ed14..53fb314 100644
--- a/liblttng-ust/lttng-context-vpid.c
+++ b/liblttng-ust/lttng-context-vpid.c
@@ -27,17 +27,6 @@
 #include <lttng/ust-tracer.h>
 #include <lttng/ringbuffer-config.h>
 
-#ifdef __linux__
-static inline
-pid_t wrapper_getpid(void)
-{
-	return getpid();
-}
-
-void lttng_context_vpid_reset(void)
-{
-}
-#else
 /*
  * We cache the result to ensure we don't trigger a system call for
  * each event.
@@ -60,7 +49,6 @@ void lttng_context_vpid_reset(void)
 {
 	cached_vpid = 0;
 }
-#endif
 
 static
 size_t vpid_get_size(struct lttng_ctx_field *field, size_t offset)
-- 
2.7.4



More information about the lttng-dev mailing list