/proc/pid/smaps - XXX: What does 's' in "smaps" stand
for?
- /proc/pid/smaps (since Linux 2.6.14)
- This file shows memory consumption for each of the process's mappings.
(The pmap(1) command displays similar information, in a form that
may be easier for parsing.) For each mapping there is a series of lines
such as the following:
-
00400000-0048a000 r-xp 00000000 fd:03 960637 /bin/bash
Size: 552 kB
Rss: 460 kB
Pss: 100 kB
Shared_Clean: 452 kB
Shared_Dirty: 0 kB
Private_Clean: 8 kB
Private_Dirty: 0 kB
Referenced: 460 kB
Anonymous: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
ProtectionKey: 0
VmFlags: rd ex mr mw me dw
- The first of these lines shows the same information as is displayed for
the mapping in /proc/pid/maps. The following lines show the
size of the mapping, the amount of the mapping that is currently resident
in RAM ("Rss"), the process's proportional share of this mapping
("Pss"), the number of clean and dirty shared pages in the
mapping, and the number of clean and 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. "Swap" shows how much
would-be-anonymous memory is also used, but out on swap.
- The "KernelPageSize" line (available since Linux 2.6.29) is the
page size used by the kernel to back the virtual memory area. This matches
the size used by the MMU in the majority of cases. However, one
counter-example occurs on PPC64 kernels whereby a kernel using 64 kB as a
base page size may still use 4 kB pages for the MMU on older processors.
To distinguish the two attributes, the "MMUPageSize" line (also
available since Linux 2.6.29) reports the page size used by the MMU.
- The "Locked" indicates whether the mapping is locked in memory
or not.
- The "ProtectionKey" line (available since Linux 4.9, on x86
only) contains the memory protection key (see pkeys(7)) associated
with the virtual memory area. This entry is present only if the kernel was
built with the CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
configuration option (since Linux 4.6).
- The "VmFlags" line (available since Linux 3.8) represents the
kernel flags associated with the virtual memory area, encoded using the
following two-letter codes:
-
rd |
- |
readable |
wr |
- |
writable |
ex |
- |
executable |
sh |
- |
shared |
mr |
- |
may read |
mw |
- |
may write |
me |
- |
may execute |
ms |
- |
may share |
gd |
- |
stack segment grows down |
pf |
- |
pure PFN range |
dw |
- |
disabled write to the mapped file |
lo |
- |
pages are locked in memory |
io |
- |
memory mapped I/O area |
sr |
- |
sequential read advise provided |
rr |
- |
random read advise provided |
dc |
- |
do not copy area on fork |
de |
- |
do not expand area on remapping |
ac |
- |
area is accountable |
nr |
- |
swap space is not reserved for the area |
ht |
- |
area uses huge tlb pages |
sf |
- |
perform synchronous page faults (since Linux 4.15) |
nl |
- |
non-linear mapping (removed in Linux 4.0) |
ar |
- |
architecture specific flag |
wf |
- |
wipe on fork (since Linux 4.14) |
dd |
- |
do not include area into core dump |
sd |
- |
soft-dirty flag (since Linux 3.13) |
mm |
- |
mixed map area |
hg |
- |
huge page advise flag |
nh |
- |
no-huge page advise flag |
mg |
- |
mergeable advise flag |
um |
- |
userfaultfd missing pages tracking (since Linux 4.3) |
uw |
- |
userfaultfd wprotect pages tracking (since Linux 4.3) |
- The /proc/pid/smaps file is present only if the
CONFIG_PROC_PAGE_MONITOR kernel configuration option is
enabled.