Re: [PATCH V6 02/17] perf tools: Ensure thread-stack is flushed

From: Adrian Hunter
Date: Fri Jun 19 2015 - 01:50:14 EST

On 19/06/2015 12:56 a.m., Arnaldo Carvalho de Melo wrote:
Em Fri, May 29, 2015 at 04:33:30PM +0300, Adrian Hunter escreveu:
The thread-stack represents a thread's current stack. When
a thread exits there can still be many functions on the stack
e.g. exit() can be called many levels deep, so all the callers
will never return. To get that information output, the
thread-stack must be flushed.

Previously it was assumed the thread-stack would be flushed
when the struct thread was deleted. With thread ref-counting
it is no longer clear when that will be, if ever. So instead

It'll be when the last reference to that thread is released.

- Arnaldo

explicitly flush all the thread-stacks at the end of a session.

If after the session ends you have no more need for those thread stacks,
that is the right way to do it.

With tools like 'report', after the session ends we should have all the
unreferenced threads deleted.

Previously they were not being deleted at all, i.e. they were simply
moved to the dead_threads list and sat there because I didn't knew if
some hist_entry, say, had a pointer to it.

So, unless I am missing something, this patch is required irrespective
of thread refcounting, no?

IIRC we used to delete all the dead threads too, but explicit flushing is better in any case.

I'm applying it to my work branch where I'm trying to test all this.

Thank you!
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at