Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 466157

Summary: kernel doesn't supply memory fields in getrusage, /usr/bin/time anything shows "... (0avgtext+0avgdata 0maxresident)k ..."
Product: Red Hat Enterprise Linux 5 Reporter: Frank Ch. Eigler <fche>
Component: kernelAssignee: Cong Wang <amwang>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4CC: cww, eguan, jpirko, mgoulish, pbenas, qcai, rkhan, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 20:43:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 502912, 600363    

Description Frank Ch. Eigler 2008-10-08 19:05:16 UTC
Description of problem:


Version-Release number of selected component (if applicable):
time-1.7-27.2.2 and others.

How reproducible:
regularly

Steps to Reproduce:
1. /usr/bin/time any program
2. observe that the memory-related values are always zero

It may well be that this is a missing kernel feature.
If so, either it should be fixed, or else /usr/bin/time
should be fixed not to display these dummy values.

Comment 1 Roman Rakus 2009-01-06 12:46:05 UTC
I think you find what was already found
man time says:
BUGS
       Not all resources are measured by all versions of Unix, so some of the values might be reported as zero.  The present selection was  mostly  inspired
       by the data provided by 4.2 or 4.3BSD.

I think, in this state, it is well documented, not looking like a bug.

Comment 2 Frank Ch. Eigler 2009-01-08 19:23:42 UTC
This is a kernel issue, possibly being addressed upstream:
http://lkml.indiana.edu/hypermail/linux/kernel/0812.3/01695.html

I suggest reassigning this to the kernel component once this patch or a
descendant is upstream.

Comment 3 RHEL Program Management 2009-03-26 17:13:21 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 4 mick 2009-11-24 15:22:52 UTC
Closely related: getrusage() does not fill in resident-set-size related fields.  

This leaves a process with no way to get an immediate snapshot of its own mem usage without reading /proc.

Comment 5 Cong Wang 2009-12-04 10:05:45 UTC
Jiri, you posted a patch for this some days ago:
http://lkml.org/lkml/2009/1/15/290

How is it going? It is not merged into upstream.
Woud like to continue to work on that? Or let me do?

Thanks!

Comment 6 Jiri Pirko 2009-12-07 14:20:37 UTC
The patch was accepted after some modifications:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=1f10206cf8e945220f7220a809d8bfc15c21f9a5

Comment 7 Cong Wang 2009-12-08 02:26:33 UTC
(In reply to comment #6)
> The patch was accepted after some modifications:
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=1f10206cf8e945220f7220a809d8bfc15c21f9a5  

Ah, I saw that one. What I meant above is the other part, i.e. for 'ru_ixrss' etc.
I checked the latest upstream, it doesn't have your patch for that.

Now I am trying another appoach to implement that, will send it to upstream after it is done, with you Cc'ed.

Thanks.

Comment 9 RHEL Program Management 2010-05-20 12:45:26 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 11 Jarod Wilson 2010-05-25 21:10:16 UTC
in kernel-2.6.18-200.el5
You can download this test kernel from http://people.redhat.com/jwilson/el5

Detailed testing feedback is always welcomed.

Comment 13 Eryu Guan 2010-11-02 10:43:46 UTC
On patched kernel the memory-related values are not all zeros
[root@dell-pet310-02 466157-getrusage]# uname -a
Linux dell-pet310-02.lab.bos.redhat.com 2.6.18-230.el5 #1 SMP Thu Oct 28 17:09:10 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@dell-pet310-02 466157-getrusage]# /usr/bin/time ls
child  child.c  getrusage  getrusage.c
0.00user 0.00system 0:00.00elapsed ?%CPU (0avgtext+0avgdata 3440maxresident)k
0inputs+0outputs (0major+255minor)pagefaults 0swaps
[root@dell-pet310-02 466157-getrusage]#

Also tested using cases described at http://lkml.org/lkml/2008/12/30/79 , result is good.

Comment 14 Frank Ch. Eigler 2010-11-02 12:28:34 UTC
It's nice to see the maxresident number, though still zero avgtext/avgdata.

Comment 16 errata-xmlrpc 2011-01-13 20:43:53 UTC
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 therefore 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.

http://rhn.redhat.com/errata/RHSA-2011-0017.html