Bug 10702 - Not aggregating thread stats in parent
Summary: Not aggregating thread stats in parent
Status: RESOLVED OBSOLETE
Alias: None
Product: Process Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: process_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-15 05:44 UTC by Mark Seger
Modified: 2013-12-19 13:55 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.23.11
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Mark Seger 2008-05-15 05:44:16 UTC
After a brief email exchange Andrew confirmed this was an oversight in the design and that I should submit a bugzilla.

If I run a threaded process and display the process I/O statistics I do not see any of the threads' I/O stats accounted for in the parent.  This is inconsistent with the way CPU load is reported in /proc/pid which does aggregate the cpu load of the children.

Furthermore, if one looks at the cpu of a parent in /proc/pid/task/pid, one then only sees the parent's cpu load without the thread loads included.  Individual thread loads show up in both /proc/tid/stat as well as /proc/pid/task/tid/stat.  There is no io directory below /proc/pid/task/pid/ and it would be more consistent with the general process statistics model it were there.

The way I reproduced this was to simply run collectl, http://collectl.sourceforge.net/, with a refresh interval of 1 second while watching a perl script named 'thread' via the command:

collectl -i:1 -sZ -Zcthread

and as you can see from the following, there is no I/O being reported:

# PROCESS SUMMARY (faults are /sec)
# PID  User     PR  PPID S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
11868  root     20 11562 S   73M    5M  2  0.23  0.02  25   0:03.28    0    0    0    0 /usr/bin/perl
11868  root     20 11562 S   73M    5M  2  0.24  0.01  24   0:03.54    0    0    0    0 /usr/bin/perl
11868  root     20 11562 S   73M    5M  2  0.20  0.05  25   0:03.79    0    0    0    0 /usr/bin/perl

Furthermore, if I tried to look at the threads by including a '+' right before the string 'thread.pl' I got errors in collectl because I was looking in /proc/pid/task/tid/io and that directory doesn't exist.  Here's an example from a soon-to-be-released version that looks in /proc/tid/io to get the I/O and you can see the the thread's I/O and nothing reported in the parent and note I'm also include the timestamp switch so I can differentiate between collection invervals.  The thread have a + after their PID:

collectl -i:1 -sZ -Zc+thread.pl -oT
# PROCESS SUMMARY (faults are /sec)
#          PID  User     PR  PPID S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
08:37:34 11945  root     20 11562 S   83M    8M  2  0.00  0.00   0   0:00.02    0    0    0    0 /usr/bin/perl
08:37:34 11946+ root     20 11562 D   83M    8M  0  0.20  0.02  22   0:06.74    0  49K    0    0 thread.pl
08:37:34 11954+ root     20 11562 D   83M    8M  0  0.12  0.00  12   0:00.48   36    0    0    0 thread.pl
08:37:35 11945  root     20 11562 S   83M    8M  2  0.00  0.00   0   0:00.02    0    0    0    0 /usr/bin/perl
08:37:35 11946+ root     20 11562 D   83M    8M  0  0.08  0.00   8   0:06.82    4  20K    0    0 thread.pl
08:37:35 11954+ root     20 11562 D   83M    8M  0  0.00  0.00   0   0:00.48   40    0    0    0 thread.pl

However, as a point of clarification, when looking at the parent in /proc/pid/io I'd like to see aggregate I/O but if looking in /proc/pid/task/pid/io only that I/O charged against the parent.

-mark

Note You need to log in before you can comment on or make changes to this bug.