Bug 142989 - Terminated threads' resource usage is hidden from procps
Terminated threads' resource usage is hidden from procps
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Ingo Molnar
Brian Brock
Depends On:
Blocks: 156322
  Show dependency treegraph
Reported: 2004-12-15 11:48 EST by Lev Makhlis
Modified: 2007-11-30 17:07 EST (History)
5 users (show)

See Also:
Fixed In Version: RHSA-2005-514
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-10-05 08:36:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test program (241 bytes, text/plain)
2004-12-15 11:50 EST, Lev Makhlis
no flags Details
backport of those two upstream changesets to 2.6.9-5.EL (4.41 KB, patch)
2005-01-18 17:57 EST, Roland McGrath
no flags Details | Diff

  None (edit)
Description Lev Makhlis 2004-12-15 11:48:28 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)

Description of problem:
In a multithreaded process, the resource usage of terminated threads
is tracked in ->signal->utime/stime/etc.  When the process dies, those
counters are rolled into the parent process' cutime/cstime/etc.  But
as long as the process is alive, getrusage(2) is the only way to see
them.  They don't show anywhere in /proc, nor consequently in ps(1) or
top(1).  This is a problem with processes that spawn many threads
which do work and then terminate.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. See attached rusage.c
2. cc rusage.c -lpthread
3. ./a.out & sleep 5 ; ps SH -p $! ; sleep 5 ; ps SH -p $! ; kill $!

Actual Results:  [1] 16894
16894 pts/1    Sl     0:00 ./a.out
16894 pts/1    Rl     0:05 ./a.out
16894 pts/1    S      0:00 ./a.out
[1]+  Terminated              ./a.out

Expected Results:  Second "ps" should show 0:10

Additional info:

See also my original description of the problem at

Please consider merging Albert Cahalan's and mine patches from 2.6.10-rc1:
Comment 1 Lev Makhlis 2004-12-15 11:50:06 EST
Created attachment 108630 [details]
Test program
Comment 2 Jason Baron 2004-12-23 16:28:10 EST
looks like good U1 material. adding to U1 blocker list.
Comment 3 Roland McGrath 2005-01-17 23:34:24 EST
Upstream patches by the bug reporter fixed this between 2.6.9 and 2.6.10:
Comment 5 Roland McGrath 2005-01-18 17:57:28 EST
Created attachment 109951 [details]
backport of those two upstream changesets to 2.6.9-5.EL

# /proc/TGID/stat with multithreaded CPU time totals (#142989)
%patch1702 -p1
Comment 7 Elena Zannoni 2005-06-09 16:24:08 EDT
This should not be on Roland plate anymore. He posted the patch to the list,
back in January. I don't think there is anything else we can do to help.
Comment 13 Red Hat Bugzilla 2005-10-05 08:36:14 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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