开发者

Want to make /proc/*/smaps output anonymous region sum and /proc/meminfo AnonPages to match to trace actual memory usage precisely

I want to see the precise amount of memory each processes use as anonymous page, because anonymous memory cannot be paged out, thus tracking this usage precisely is important.

One way to get the whole sum of anonymous page is to read /proc/meminfo AnonPages.

The other way is to add up all the entries in smaps file which matches follows:

  • no name
  • [stack]
  • [heap]
  • /dev/zero
  • /dev/shm/...
  • Relocated section private_dirty

    Section used for relocation would be updated for each process, which makes some private_dirty region in a named mapping region. Elf loader seems to change read/write attribute using mprotect when doing relocation, so it is difficult to differentiate such region from a data section, and making it difficult to track these usage from each process point of view

So I would like to know how to differentiate the above relocated section, and to precisely track the anonymous memory usage for each processes.

Maybe we should a开发者_开发知识库dd new entry in /proc/*/smaps to show the amount of Anonymous memory for each section.


I've found this diff which was done 2010 October, which just answer my question.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b40d4f84becd69275451baee7f0801c85eb58437

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/Documentation/filesystems/proc.txt?id=b40d4f84becd69275451baee7f0801c85eb58437&id2=d16e15f5b029fc7d03540ba0e5fb23b0abb0ebe0

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/fs/proc/task_mmu.c?id=b40d4f84becd69275451baee7f0801c85eb58437&id2=d16e15f5b029fc7d03540ba0e5fb23b0abb0ebe0

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜