开发者

Overhead of VMA's on Linux

The question: How can I tell how much memory is in use by the VMA's of my process (either when I'm in userspace or in kernel) ?

I'll give a short explanation on what I'm doing, So you could understand why I'm asking this. I run on my Linux machine a few processes and one driver (kernel module). The processes memory is locked (not swappable), Therefore I want to make sure that the memory consume by the module along with the processes isn't acceding 90% of my total physical memory. In order to redu开发者_开发百科ce malloc overhead I'm using mmap. what I really need to know is how much memory my processes are really consuming rather than how much they asked for, and as much as I can tell I'm only missing the VMA's overhead of any allocation.


After digging I've found the answer:

While I'm in the driver I can use current->mm->map_count To know the current number of VMA's for the current process. Multiply it by sizeof(struct vm_area_struct) will give me what I was looking for. From here the accounting is pretty simple.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜