Re: Re: VmSiZE to physical memory mapping

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

 



Hello...

A hard question for me to answer....But. i'll try..

> 2. VmRSS is physical memory being used by the system.
>
> > Now, in case of shared libraries the space used by library will be
> > added in VmRSS of all the processes which are loading it or only to
> > one process. If to all process then
> >
> > parameter(A) + parameter(B) + parameter(C) + parameter(D) +
> > parameter(E) = (MemTotal - MemFree)
> > wont be satisfied.

Hm, ok I admit I am a bit confused too here. OK, allow me to re phrase. 
What I meant by "consumed" is actually "there is a page table entry 
pointing to a page frame".

So, in case of the dynamic shared library (like you give as 
illustration), the size of each shared libraries is added to RSS 
property of each file. This means, RSS is not really valid to describe 
memory consumption of a process. Hmmm, I think anon_rss describe it 
better, but this property doesn't include the size of file backed 
memory mapping.

Maybe you should ask the real expert about it. Rik? Arjan? Marcelo? 
anyone?

> > 3. free gives me the below shown output:
> >
> >                        total         used         free       shared
> > buffers
> >   Mem:       502180       424100        78080            0         
> > 340 Swap:            0            0            0
> >   Total:       502180       424100        78080
> >
> > Already a lots of processes are running on my system.  Is it
> > buffers = 340 KB memory being used by page cache etc and remaining
> > ie 512MB(524288 Kb) - 340 KB = 523948 KB should be shown as total
> > (which is not matching here....???)

"Total" here is not actually all the RAM that is currently installed in 
your motherboard. I prefer to say to name it "RAM area that is not 
reserved for kernel usage". if you look at /arch/i386/mm/init.c, you 
will notice that "Total RAM" is actually taken from totalram_pages 
variable. This variable represent the pages currently allocated into 
memory zones (ZONE_NORMAL, ZONE_DMA, ZONE_HIGHMEM) plus the memory area 
released after no longer need by the kernel. Where's the rest? it is 
reserved for kernel codes, memory holes defined in BIOS and other 
kernel special needs

> > 4. Can you tell me any fuction in C which returns the info as shown
> > in /proc/$PID/status file?
> > Basically i need mem usage of that process.
> > I tried getrusage() function. it return 0  for both 
> > usage.ru_maxrss and usage.ru_ixrss

Sorry, I have no idea so far.

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