Re: Regarding /proc/<pid>/status

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

 



In case swap space is 0 then VmSize should be equal to VmRSS

[83000004-7] NetDebug> cat /proc/428/status
Name:   bgp
State:  S (sleeping)
Tgid:   428
Pid:    428
PPid:   377
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 32
Groups:
VmSize:    27640 kB
VmLck:         0 kB
VmRSS:     26328 kB
VmData:    23992 kB
VmStk:        72 kB
VmExe:       596 kB
VmLib:      2780 kB
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001004
SigCgt: 0000000000004000
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff
[83000004-7] NetDebug>
[83000004-7] NetDebug> cat /proc/meminfo
       total:    used:    free:  shared: buffers:  cached:
Mem:  514232320 434356224 79876096        0   348160 60350464
Swap:        0        0        0
MemTotal:       502180 kB
MemFree:         78004 kB
MemShared:           0 kB
Buffers:           340 kB
Cached:          58936 kB
SwapCached:          0 kB
Active:          13680 kB
Inactive:       179368 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       502180 kB
LowFree:         78004 kB
SwapTotal:           0 kB
SwapFree:            0 kB
[83000004-7] NetDebug>


Then why do the two differ here???

Regards
Shivali

shivaligupta wrote:

Suppose we have two processes A and B
Both uses a shared library C
Process A initial vmsize without loading C is x
and Process B initial vmsize without loading C is y
Now Process A loads shared library C, so its Vmsize becomes x+z, where z is vmsize for C

Now Process B tries toload shared library C, but as its mmap calls see that this library is already loaded it wont load C again.

Now my doubt is that whether Process B vmsize will now be y or y+z ????


Regards

Shivali




shivaligupta wrote:

Mulyadi Santosa wrote:

Dear shivaligupta

But in the below given example VmSize >> VmLib + VmExe + VmData
+VmStk what does that indicate?

bash-2.05b# cat /proc/16108/status
Name:   thunderbird
State:  S (sleeping)
Tgid:   16108
Pid:    16108
PPid:   4436
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 256
Groups: 0 1 2 3 4 6 10
VmSize:     4156 kB
VmLck:         0 kB
VmRSS:         4 kB
VmData:      108 kB
VmStk:        24 kB
VmExe:       592 kB
VmLib:      1312 kB



As you can see there, VmSize is bigger than the total. Why? Because VmSize represent the size of all allocated VMA. A size of all VMAs doesn't equal to current memory consumption, because the page might not exist there
Then the page will be in swap space.(plz correct me if i m wrong)
How can i know how much memory this process has taken in swap?
I guess that stack and heap will always be in memory. so is it like
that the memory consumed in swap is because of code segment + data segment.


In the other hand, VmData and VmRSS represent pages that do exist in RAM (not swapped to disk and already fetch from backed file, if any). This is usually smaller than the actual VMA size since a program usually just use some portion of the its entire dataset in certain period.


Can nyone tell me the links from where i can get proper info about
memory profiling and memory limiting??



Memory profiling? in kernel space? or user space? In user space, maybe you can use valgring. In kernel space, perhaps you can turn on the kmalloc debugging.

I mean memory profiling in user space. Using valgrind, i can calculate memory used by a particular process.
But what will happen in case of shared libraries?

And about memory limiting, I don't understand. You mean something "ulimit" ?
Memory limiting means restricting a process to use only certain amount of memory(either less than that or equal to that) if the process tries to use more memory than that it should exit. i know i can use setrlimit for that. is there any other way out?



PS: Sorry, I send this e-mail using non subscribed account in kernelnewbies. Can you kindly repost this message to the forum, please?

regards


Mulyadi




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






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