Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given a PID of the process running in Linux (latest kernel), how do I find out:

  1. The number of pages it is using
  2. The size of each page it is using (4K, 2MB or 1GB)

This is for x86-64 architecture.

share|improve this question

Pagesize is system wide and can be found with the getconf command

getconf PAGESIZE

The tool can provide some more detailed information on a processes memory usage.

share|improve this answer
ok, I got it , its is called MMUPageSize and it appears in /proc/pid/statm – Nulik Nov 6 '11 at 3:19

Depending on how verbose the information you want should be, you want one of the following:

  • /proc/pid/statm: Provides information about memory usage, measured in pages.
  • /proc/pid/status: Provides much of the information from /proc/pid/statm, but is easier to read.

Check out the man-page for the proc-files for thorough documentation of what the different columns mean.

share|improve this answer
well, 'statm' doesn't provide info per page size. What if my process uses 10 pages of 4K size, 20 pages of 2MB size and 1 page of 1GB size? neither 'status' provides info about the amount of each page size. – Nulik Nov 5 '11 at 15:21
@Nulik do you know if you have huge pages enabled ? – Iain Nov 5 '11 at 17:25
@Iain yes, /proc/filesystems says "nodev hugetlbfs" – Nulik Nov 6 '11 at 3:14
btw, man 5 proc don't show the latest changes for 2.6.34 – Nulik Nov 6 '11 at 3:26

The number of pages it is using

awk '{ print $24 }' /proc/[pid]/stat


awk '{ print $2 }' /proc/[pid]/statm

According to the man proc, it is the number of pages the process has in real memory. Also take a look at the procstat.c to display proc stat in human readable format.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.