This is an old revision of the document!
Proc - smaps file
For SMP CONFIG users.
For making accounting scalable, RSS related information are handled in asynchronous manner and the value may not be very precise. To see a precise snapshot of a moment, you can see /proc/<pid>/smaps file and scan page table. It's slow but very precise.
The /proc/PID/smaps is an extension based on maps, showing the memory consumption for each of the process's mappings. This file is only present if the CONFIG_MMU kernel configuration option is enabled.
For each of mappings there is a series of lines such as the following:
address | perms | offset | dev | inode | pathname |
---|---|---|---|---|---|
08048000-080bc000 | r-xp | 00000000 | 03:02 | 13130 | /bin/bash |
Size: | 1084 kB |
Rss: | 892 kB |
Pss: | 374 kB |
Shared_Clean: | 892 kB |
Shared_Dirty: | 0 kB |
Private_Clean: | 0 kB |
Private_Dirty: | 0 kB |
Referenced: | 892 kB |
Anonymous: | 0 kB |
Swap: | 0 kB |
KernelPageSize: | 4 kB |
MMUPageSize: | 4 kB |
where:
- The first of these lines shows the same information as is displayed for the mapping in /proc/PID/maps.
- Size is the size of the mapping.
- RSS is the amount of the mapping that is currently resident in RAM.
- PSS is the process' proportional share of this mapping.
- Shared_Clean is the number of clean shared pages in the mapping.
- Shared_Dirty is the number of dirty shared pages in the mapping.
- Private_Clean is the number of clean private pages in the mapping.
- Private_Dirty is the number of dirty private pages in the mapping.
- Referenced indicates the amount of memory currently marked as referenced or accessed.
- Anonymous shows the amount of memory that does not belong to any file.
- Even a mapping associated with a file may contain anonymous pages: when MAP_PRIVATE and a page is modified, the file page is replaced by a private anonymous copy.
- Swap shows how much would-be-anonymous memory is also used, but out on swap.
NOTE: Even a page which is part of a MAP_SHARED mapping, but which only has a single private mapped, i.e. is currently used by only one process, is accounted as private and not as shared.