November 23, 2019 at 4:37 pm #81023Ehi KioyaKeymaster@ehi-kioya
If you have ever tried to figure out why Linux is running low on memory, you will agree that the memory usage information provided by the kernel is not exactly easy to understand. This post will attempt to provide a quick explanation of what Pss means in the /proc/PID/smaps file.
/proc/PID/smaps is an extension based on maps. It shows the memory consumption for each of a process’ mappings. For each mapping, there are a series of lines (see the block below for a sample portion of the smaps file of a random process – I grabbed that from one of my Linux boxes).
PSS stands for Proportional Set Size.
The Pss of a process is a count of the number of pages the process has in memory. But this isn’t a straightforward count. Each page is divided by the number of processes sharing it. So if our process has 1000 pages by itself alone, and another 1000 shared with one other process, the Pss of our process will be 1500.
Here’s how a portion of a typical smaps file may look like. Notice the variables:123456789101112131415161718192021562baaa22000-562baae25000 r-xp 00000000 fc:01 2692 /usr/bin/php-cgi7.2Size: 4108 kBKernelPageSize: 4 kBMMUPageSize: 4 kBRss: 3740 kBPss: 225 kBShared_Clean: 3740 kBShared_Dirty: 0 kBPrivate_Clean: 0 kBPrivate_Dirty: 0 kBReferenced: 3740 kBAnonymous: 0 kBLazyFree: 0 kBAnonHugePages: 0 kBShmemPmdMapped: 0 kBShared_Hugetlb: 0 kBPrivate_Hugetlb: 0 kBSwap: 0 kBSwapPss: 0 kBLocked: 0 kBVmFlags: rd ex mr mw me dw sd
In this case, Pss = 225 kB.
The first line above shows the same information for the mapping as is contained in the /proc/PID/maps file. The other lines provide a number of extra details including:
- The mapping size (Size)
- The proportional share of this mapping that belongs to the process (Pss)
- The amount of the mapping that currently sits in RAM (Rss)
- The amount of memory currently marked as referenced or accessed (Referenced)
- How many dirty and clean private pages are in the mapping (Private_Dirty and Private_Clean respectively). Note: Even if a page is part of the MAP_SHARED mapping, if it has only one pte mapped, is counted as private (not as shared).
- The amount of memory that does not belong to any file (Anonymous)
- The amount of would-be-anonymous memory that is used but stored on swap (Swap)
This post is primarily for reference purposes. My explanation is based on some of the information provided at the Linux Kernel Documentation.
You must be logged in to reply to this topic.