All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lttng-ust 2/2] Fix: cache the result of getpid() internally
       [not found] <1520030186-5612-1-git-send-email-mjeanson@efficios.com>
@ 2018-03-02 22:36 ` Michael Jeanson
  2018-03-05 15:43 ` [PATCH lttng-ust 1/2] Fix: reset cached vpid context on fork Mathieu Desnoyers
  1 sibling, 0 replies; 2+ messages in thread
From: Michael Jeanson @ 2018-03-02 22:36 UTC (permalink / raw)
  To: lttng-dev

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@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

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH lttng-ust 1/2] Fix: reset cached vpid context on fork
       [not found] <1520030186-5612-1-git-send-email-mjeanson@efficios.com>
  2018-03-02 22:36 ` [PATCH lttng-ust 2/2] Fix: cache the result of getpid() internally Michael Jeanson
@ 2018-03-05 15:43 ` Mathieu Desnoyers
  1 sibling, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2018-03-05 15:43 UTC (permalink / raw)
  To: Michael Jeanson; +Cc: lttng-dev

Both patches merged into master, 2.10, 2.9, thanks!

Mathieu

----- On Mar 2, 2018, at 5:36 PM, Michael Jeanson mjeanson@efficios.com wrote:

> We currently reset the cached vtid on fork but not the vpid. This is not
> a problem on Linux because we don't cache the vpid internally but call
> getpid() directly and rely on the glibc pid cache.
> 
> Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> ---
> liblttng-ust/lttng-ust-comm.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
> index 4391446..d4add1c 100644
> --- a/liblttng-ust/lttng-ust-comm.c
> +++ b/liblttng-ust/lttng-ust-comm.c
> @@ -2011,6 +2011,7 @@ void ust_after_fork_child(sigset_t *restore_sigset)
> {
> 	if (URCU_TLS(lttng_ust_nest_count))
> 		return;
> +	lttng_context_vpid_reset();
> 	lttng_context_vtid_reset();
> 	DBG("process %d", getpid());
> 	/* Release urcu mutexes */
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-05 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1520030186-5612-1-git-send-email-mjeanson@efficios.com>
2018-03-02 22:36 ` [PATCH lttng-ust 2/2] Fix: cache the result of getpid() internally Michael Jeanson
2018-03-05 15:43 ` [PATCH lttng-ust 1/2] Fix: reset cached vpid context on fork Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.