Discussion:
/proc/<pid>/statm doesnt match with status
shivaligupta
2006-04-10 11:05:53 UTC
Permalink
[83000004-7] NetDebug> cat /proc/352/status
Name: bgp
State: S (sleeping)
Tgid: 352
Pid: 352
PPid: 322
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 32
Groups:
VmSize: 9604 kB
VmLck: 0 kB
VmRSS: 7852 kB
VmData: 5832 kB
VmStk: 72 kB
VmExe: 536 kB
VmLib: 2924 kB
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001004
SigCgt: 0000000000004000
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff

[83000004-7] NetDebug> cat /proc/352/statm
1963 1963 350 59 0 1904 1614
[83000004-7] NetDebug>


Why the info in two doesnt match???
As far as i know first fields in statm is total program size(1963 * 4096
= 8040448 bytes)
and VmSize is also total prog size = 9604 * 1024 = 9834496 bytes.

why the two doesn't match??

whereas VmRSS = 7852 * 1024 = 8040448 = total prog size displayed in statm.

isnt it a bug?

Regards
Shivali


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
shivaligupta
2006-04-27 11:24:01 UTC
Permalink
83000004-7] NetDebug> cat /proc/352/status
Name: bgp
State: S (sleeping)
Tgid: 352
Pid: 352
PPid: 322
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 32
Groups:
VmSize: 9604 kB
VmLck: 0 kB
VmRSS: 7852 kB
VmData: 5832 kB
VmStk: 72 kB
VmExe: 536 kB
VmLib: 2924 kB
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001004
SigCgt: 0000000000004000
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff

[83000004-7] NetDebug> cat /proc/352/statm
1963 1963 350 59 0 1904 1614
[83000004-7] NetDebug>


Why the info in two doesnt match???
As far as i know first fields in statm is total program size(1963 * 4096
= 8040448 bytes)
and VmSize is also total prog size = 9604 * 1024 = 9834496 bytes.

why the two doesn't match??

whereas VmRSS = 7852 * 1024 = 8040448 = total prog size displayed in statm.

isnt it a bug?

Regards
Shivali



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
Mulyadi Santosa
2006-04-28 09:20:24 UTC
Permalink
Hi Shivali...
Post by shivaligupta
83000004-7] NetDebug> cat /proc/352/status
VmSize: 9604 kB
VmLck: 0 kB
VmRSS: 7852 kB
[83000004-7] NetDebug> cat /proc/352/statm
1963 1963 350 59 0 1904 1614
Why the info in two doesnt match ???
To make it clearer , Shivali meant between VmSize of statm and the first
field of statm

OK, Shivali, this is what I got. Based on my observation on Linux kernel
2.6.14, VmSize in /proc/<pid>/status is calculated as:
(mm->total_vm - mm->reserved_vm) << (PAGE_SHIFT-10)

While in /proc/<pid>/statm, it is just equal to: mm->total_vm.
(you can check it by yourself in fs/proc/array.c. Trace starting from
proc_pid_statm() and proc_pid_status() )

So, the difference is caused by mm->reserved_vm. Further research shows
this in _vm_stat_account() (mm/mmap.c):

if (flags & (VM_RESERVED|VM_IO))
mm->reserved_vm += pages;

Thus, what we can conclude here, there is a different interpretation
about VmSize on those proc entries. I can't say it is a bug, since we
don't know the real argument from the code writer. But IMHO, VmSize
that is reported by statm reveal what is truly "overall process VM
size", no matter it is tagged as reserved, for I/O need, anonymous,
file backed and so on.

Guys, CMIIW...

regards,

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/

Loading...