[ltt-dev] [Autotest] [PATCH] LTTng trace destroy wait for readers to complete

Jiaying Zhang jiayingz at google.com
Mon Sep 22 15:15:14 EDT 2008


Hi Mathieu,

Regarding to your comment about we should probably use a waitqueue
to synchronize lttd readers and trace destroy, how about we implement
one now? See the attached patch.

Jiaying

On Mon, Sep 15, 2008 at 12:08 PM, Mathieu Desnoyers <
compudj at krystal.dyndns.org> wrote:

> Hi John,
>
> Please try the following patch instead. It should make lttctl wait until
> all lttd instances release the trace kref.
>
> Mathieu
>
>
> LTTng trace destroy wait for readers to complete
>
> Make lttctl sleep until all the lttd readers complete.
>
> Hopefully this will brighten Martin's day.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
> CC: Martin J. Bligh <mbligh at google.com>
> CC: Jiaying Zhang <jiayingz at google.com>
> CC: John Admanski <jadmanski at google.com>
> ---
>  ltt/ltt-tracer.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
>
> Index: linux-2.6-lttng/ltt/ltt-tracer.c
> ===================================================================
> --- linux-2.6-lttng.orig/ltt/ltt-tracer.c       2008-09-15
> 14:43:00.000000000 -0400
> +++ linux-2.6-lttng/ltt/ltt-tracer.c    2008-09-15 14:58:03.000000000 -0400
> @@ -40,6 +40,7 @@
>  #include <linux/fs.h>
>  #include <linux/cpu.h>
>  #include <linux/kref.h>
> +#include <linux/delay.h>
>  #include <asm/atomic.h>
>
>  static void async_wakeup(unsigned long data);
> @@ -635,6 +636,14 @@ static void __ltt_trace_destroy(struct l
>
>        module_put(trace->transport->owner);
>
> +       /*
> +        * Wait for lttd readers to release the files, therefore making
> sure
> +        * the last subbuffers have been read. Currently use a sleep,
> should
> +        * probably use a waitqueue.
> +        */
> +       while (atomic_read(&trace->kref.refcount) > 1)
> +               ssleep(1);
> +
>        kref_put(&trace->kref, ltt_release_trace);
>  }
>
>
> --
> Mathieu Desnoyers
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
> _______________________________________________
> Autotest mailing list
> Autotest at test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.casi.polymtl.ca/pipermail/lttng-dev/attachments/20080922/e0d3ca2a/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: waitqueue.patch
Type: text/x-patch
Size: 1926 bytes
Desc: not available
URL: <http://lists.casi.polymtl.ca/pipermail/lttng-dev/attachments/20080922/e0d3ca2a/attachment-0003.bin>


More information about the lttng-dev mailing list