Re: /proc/<pid>/statm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shivali...

> 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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux