views:

1473

answers:

4

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

+2  A: 

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

D.Shawley
What Unix allows you to read the pagetablesize (opposed to pagesize) via sysctl?
eckes
+3  A: 

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

$ cat /proc/meminfo | grep PageTables
PageTables:      24496 kB
lothar
This is useful, but I need to find out whether this size is "too big". If there is a limit to this size that would call fork() to fail, and how close to that limit is the kernel. Ideally, I would also need to find out what portion of that PageTables size is being used by a specific process, such that when fork() tries to copy the tables for that process, the limit would be exceeded.
Reed Hedges
+1  A: 

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.

TMN
+1  A: 

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

eckes
Oh BTW, some numbers with Huge pages now:http://kevinclosson.wordpress.com/2009/07/28/quantifying-hugepages-memory-savings-with-oracle-database-11g/
eckes