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

后端 未结 5 1705
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 03:46

How can I find out how big a Linux process\'s page table is, along with any other variable-size process accounting?

相关标签:
5条回答
  • 2021-02-02 04:04

    Not sure about Linux, but most UNIX variants provide sysctl(3) for this purpose. There is also the sysctl(8) command line utility.

    0 讨论(0)
  • 2021-02-02 04:07

    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.

    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. 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. (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/)

    0 讨论(0)
  • 2021-02-02 04:10

    Since Linux 2.6.10, the amount of memory used by a single process' page tables has been exposed via the VmPTE field of /proc/<pid>/status.

    0 讨论(0)
  • 2021-02-02 04:13

    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. Not sure if this works in Linux, but it might be worth typing "man 3 nlist" and seeing what comes back.

    0 讨论(0)
  • 2021-02-02 04:20

    If you are really interested in the page tables, do a

    $ cat /proc/meminfo | grep PageTables
    PageTables:      24496 kB
    
    0 讨论(0)
提交回复
热议问题