Skip to contentSkip to conversation

taskstats and /proc/.../io asymmetry?

DISCUSSION Mark Seger 2 participants 2 messages May 14, 2008 – May 16, 2008

lore
Share & tools
lore

Mark Seger

author
#0 lore raw

If you look at /proc/pid/stat, you can get the total CPU consumed by a process. If you look at /proc/pid/task/tid/stat you can get the cpu consumed by a thread and if the tid is that of the parent you only gets its consumption as opposed to all its children.

I was surprised to see that the way process I/O is reported doesn't follow this model. There are no /prod/pid/task/tid/io entries but rather you need to look in /proc/tid/io. While I view this as a minor inconvenience, I can certainly live with it. However, /proc/pid/io does not show the aggregate I/O numbers for the whole process and that both surprises and disappoints. This means if I have a process that starts a bunch of worker threads that do the real work and I want to find the top I/O consumers I can't simply walk the /proc/pid tree but rather have to look at all the threads of each process and add them up.

Or am I missing something?

-mark

#1 lore raw
Quoted 15 lines · Mark Seger

If you look at /proc/pid/stat, you can get the total CPU consumed by a process. If you look at /proc/pid/task/tid/stat you can get the cpu consumed by a thread and if the tid is that of the parent you only gets its consumption as opposed to all its children.

I was surprised to see that the way process I/O is reported doesn't follow this model. There are no /prod/pid/task/tid/io entries but rather you need to look in /proc/tid/io. While I view this as a minor inconvenience, I can certainly live with it. However, /proc/pid/io does not show the aggregate I/O numbers for the whole process and that both surprises and disappoints. This means if I have a process that starts a bunch of worker threads that do the real work and I want to find the top I/O consumers I can't simply walk the /proc/pid tree but rather have to look at all the threads of each process and add them up.

Quoted 2 lines

Or am I missing something?

I looked through the code and your argument seems to be correct. The behaviour is inconsistent w.r.t. other statistics like utime and stime. We currently accumulate tgid information in signal_struct, we need to do something similar for io as well. If nobody gets to it by the time I finish my backlog, I'll try and get to it.

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL