Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 934
Reed Hedges Avatar asked May 12 '09 16:05

Reed Hedges


People also ask

Is there a page table for the kernel?

Kernel page table. The kernel uses a separate page table to manage the page-table-mapped kernel segment. In contrast to user space, where there is one page table per process, this page table belongs to the kernel and is in effect independent of which process is running.

Where is the page table located Linux?

The page table of the process is held in the kernel space. The kernel may have several page tables in RAM, but only one is the active page table. In x86 CPUs, it's the page table pointed by register CR3.

What is Linux page table?

A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between virtual addresses and physical addresses.

What is per process page table?

Page table translates from virtual to physical page addresses. Since each process has its own virtual address space and usually maps the same virtual address to a different physical address it needs a separate page table. Curiously, multiple processes may map different virtual addresses to the same physical memory.


4 Answers

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

$ cat /proc/meminfo | grep PageTables
PageTables:      24496 kB
like image 113
lothar Avatar answered Sep 28 '22 20:09

lothar


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.

like image 27
toojays Avatar answered Sep 28 '22 21:09

toojays


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

like image 45
D.Shawley Avatar answered Sep 28 '22 20:09

D.Shawley


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.

like image 31
TMN Avatar answered Sep 28 '22 22:09

TMN