简体   繁体   English

如何查找或计算Linux进程的页表大小和其他内核记帐?

[英]How to find or calculate a Linux process's page table size and other kernel accounting?

如何找出Linux进程的页表有多大,以及任何其他可变大小的进程记帐?

从Linux 2.6.10开始,单个进程的页表使用的内存量已通过/proc/<pid>/status的VmPTE字段公开。

If you are really interested in the page tables, do a 如果您真的对页表感兴趣,请执行

$ cat /proc/meminfo | grep PageTables
PageTables:      24496 kB

Not sure about Linux, but most UNIX variants provide sysctl(3) for this purpose. 不确定Linux,但大多数UNIX变体为此提供sysctl(3) There is also the sysctl(8) command line utility. 还有sysctl(8)命令行实用程序。

Hmmm, back in Ye Olden Tymes, we used to call nlist(3) to get the system address for the data we were interested in, then open /dev/kmem, seek to the address, then read the data. 嗯,回到Ye Olden Tymes,我们曾经打电话给nlist(3)来获取我们感兴趣的数据的系统地址,然后打开/ dev / kmem,寻找地址,然后读取数据。 Not sure if this works in Linux, but it might be worth typing "man 3 nlist" and seeing what comes back. 不确定这是否适用于Linux,但可能值得键入“man 3 nlist”并查看返回的内容。

You should describe your problem, and not ask about details. 您应该描述您的问题,而不是询问细节。 If you fork too much (especially with a process which has a large address space) there are all kind of things which go wrong (including out of memory), hitting a pagetable maximum size is IMHO not a realistic problem. 如果你分叉太多(特别是对于一个具有大地址空间的进程),会出现各种错误(包括内存不足),点击页面表的最大大小是恕我直言,这不是一个现实的问题。

Thad said, I would also be interested to read a process pagetable share in Linux. Thad说,我也有兴趣阅读Linux中的流程页面表共享。

As a simple rule of thumb you can however asume that each process occopies a share in the pagetable which is equal to its virtual size, for example 6 bytes for each page. 但是,作为一个简单的经验法则,您可以假设每个进程都会在页面表中显示一个等于其虚拟大小的共享,例如每个页面有6个字节。 So for example if you have a Oracle Database with 8GB SGA and 500 Processes sharing it, each of the process will use 14MB pagetable, which results in 7GB pagetables+8GB SGA. 因此,例如,如果您拥有一个8GB SGA和500个进程共享的Oracle数据库,则每个进程将使用14MB页面表,这将产生7GB页面表+ 8GB SGA。 (sample numbers from http://kevinclosson.wordpress.com/2009/07/25/little-things-doth-crabby-make-%E2%80%93-part-ix-sometimes-you-have-to-really-really-want-your-hugepages/ ) (样本号来自http://kevinclosson.wordpress.com/2009/07/25/little-things-doth-crabby-make-%E2%80%93-part-ix-sometimes-you-have-to-really -really-want-your-hugepages /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM