Re: [PATCH] Perf: bug fix: distinguish between rename and exec

From: David Ahern
Date: Wed Feb 15 2012 - 13:55:55 EST


On 2/15/12 10:30 AM, Peter Zijlstra wrote:
On Wed, 2012-02-15 at 09:57 -0700, David Ahern wrote:

I'm not Acme, but I do care. We use a lot of processes with named
threads that give users an idea about the function of a particular
thread.

But why would they care? If you're debugging its easy enough to see from
the backtrace and if you're not, most tools like top/ps don't even show
threads (by default).

So who cares what threads are called.

I realize I'm not going to convince anybody, but I genuinely don't see
the point of naming threads.

Very subjective. How fast do you want your users/tech staff/developers/QA testers to make sense of what is going on? Which is more informative (process and thread names sanitized)

$ top -d5

top - 18:39:49 up 23:46, 1 user, load average: 0.75, 0.37, 0.24
Cpu(s): 11.0%us, 19.0%sy, 0.0%ni, 47.8%id, 0.0%wa, 0.3%hi, 21.8%si, 0.0%st

PID USER S %CPU %MEM TIME+ COMMAND
3830 root S 62.4 1.1 1:16.68 myapp


Wow, myapp is sucking up CPU. I wonder what it's doing. 'H'.


With non-named threads:

top - 18:40:36 up 23:47, 1 user, load average: 0.89, 0.47, 0.28
Cpu(s): 15.5%us, 22.4%sy, 0.0%ni, 45.7%id, 0.0%wa, 0.6%hi, 15.9%si, 0.0%st

PID USER S %CPU %MEM TIME+ COMMAND
3891 root S 44.8 1.1 0:12.39 myapp
3879 root R 14.6 1.1 0:26.07 myapp
3893 root S 8.7 1.1 0:08.62 myapp

Ok, so 3 threads are dominating the CPU. I guess I need to hook up gdb to find out which functional areas those threads are running. Or, for one product I worked on you have to know that the thread map is dumped to a file, get shell access, read it and mentally correlate lwps.

Or you can name the threads:

top - 18:40:36 up 23:47, 1 user, load average: 0.89, 0.47, 0.28
Cpu(s): 15.5%us, 22.4%sy, 0.0%ni, 45.7%id, 0.0%wa, 0.6%hi, 15.9%si, 0.0%st

PID USER S %CPU %MEM TIME+ COMMAND
3891 root S 44.8 1.1 0:12.39 myapp:dispatch
3879 root R 14.6 1.1 0:26.07 myapp:my-mgr
3893 root S 8.7 1.1 0:08.62 myapp:worker

Sure process knowledge is needed but top gives a lot more information for named threads.

Even with perf having named threads makes the event dumps 100x more understandable because the comm name gives you a hint about what the task is does.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/