top: man page now includes resident memory enhancement

Beginning with linux-4.5, the following new fields are
being added under that /proc/<pid>/status pseudo file:
 . RssAnon - size of resident anonymous memory
 . RssFile - size of resident file mappings
 . RssShmem - size of resident shared memory

This patch just represents the initial library and top
support, sharing a commit message with 2 more patches.

p.s. locked resident memory support was also added but
isn't directly related to the kernel 4.5 enhancements.

Reference(s):
commit 1f8e41d019

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-04-13 00:00:00 -05:00 committed by Craig Small
parent 46458ab6b7
commit 91ee02f076

110
top/top.1
View File

@ -69,7 +69,7 @@
. .
.\" Document ///////////////////////////////////////////////////////////// .\" Document /////////////////////////////////////////////////////////////
.\" ---------------------------------------------------------------------- .\" ----------------------------------------------------------------------
.TH TOP 1 "October 2015" "procps-ng" "User Commands" .TH TOP 1 "April 2016" "procps-ng" "User Commands"
.\" ---------------------------------------------------------------------- .\" ----------------------------------------------------------------------
.\" ---------------------------------------------------------------------- .\" ----------------------------------------------------------------------
@ -306,7 +306,7 @@ The memory in quadrant #4, when modified, acts as its own dedicated \*(MS.
\fB1\fR | \fB2\fR \fB1\fR | \fB2\fR
\fBAnonymous\fR . stack | \fBAnonymous\fR . stack |
. malloc() | . malloc() |
. brk()/sbrk() | . brk()/sbrk() | . POSIX shm*
. mmap(PRIVATE, ANON) | . mmap(SHARED, ANON) . mmap(PRIVATE, ANON) | . mmap(SHARED, ANON)
-----------------------+---------------------- -----------------------+----------------------
. mmap(PRIVATE, fd) | . mmap(SHARED, fd) . mmap(PRIVATE, fd) | . mmap(SHARED, fd)
@ -315,14 +315,22 @@ The memory in quadrant #4, when modified, acts as its own dedicated \*(MS.
.fi .fi
The following may help in interpreting process level memory values displayed The following may help in interpreting process level memory values displayed
as columns and discussed in topic `3a. DESCRIPTIONS of Fields'. as scalable columns and discussed under topic `3a. DESCRIPTIONS of Fields'.
.nf .nf
%MEM \- simply RES divided by total \*(MP %MEM \- simply RES divided by total \*(MP
CODE \- the `pgms' portion of quadrant \fB3\fR CODE \- the `pgms' portion of quadrant \fB3\fR
DATA \- the quadrant \fB1\fR portion of VIRT DATA \- the entire quadrant \fB1\fR portion of VIRT plus all
RES \- anything occupying \*(MP (all quadrants) explicit mmap file-backed pages of quadrant \fB3\fR
RES \- anything occupying \*(MP which, beginning with
Linux-4.5, is the sum of the following three fields:
RSan \- quadrant \fB1\fR pages, which include any
former quadrant \fB3\fR pages if modified
RSfd \- quadrant \fB3\fR and quadrant \fB4\fR pages
RSsh \- quadrant \fB2\fR pages
RSlk \- subset of RES which cannot be swapped out (any quadrant)
SHR \- subset of RES (excludes \fB1\fR, includes all \fB2\fR & \fB4\fR, some \fB3\fR) SHR \- subset of RES (excludes \fB1\fR, includes all \fB2\fR & \fB4\fR, some \fB3\fR)
SWAP \- excludes quadrant \fB4\fR SWAP \- potentially any quadrant except \fB4\fR
USED \- simply the sum of RES and SWAP USED \- simply the sum of RES and SWAP
VIRT \- everything in-use and/or reserved (all quadrants) VIRT \- everything in-use and/or reserved (all quadrants)
.fi .fi
@ -684,7 +692,7 @@ any truncated data.
.TP 4 .TP 4
7.\fB DATA \*(Em Data + Stack Size (KiB) \fR 7.\fB DATA \*(Em Data + Stack Size (KiB) \fR
The amount of private anonymous memory \fIreserved\fR by a process. The amount of private memory \fIreserved\fR by a process.
It is also known as the Data Resident Set or DRS. It is also known as the Data Resident Set or DRS.
Such memory may not yet be mapped to \*(MP (RES) but will always be Such memory may not yet be mapped to \*(MP (RES) but will always be
included in the \*(MV (VIRT) amount. included in the \*(MV (VIRT) amount.
@ -781,6 +789,8 @@ And while the 2.6 kernel can be made mostly preemptible, it is not always so.
19.\fB RES \*(Em Resident Memory Size (KiB) \fR 19.\fB RES \*(Em Resident Memory Size (KiB) \fR
A subset of the virtual address space (VIRT) representing the non-swapped A subset of the virtual address space (VIRT) representing the non-swapped
\*(MP a task is currently using. \*(MP a task is currently using.
It is also the sum of the RSan, RSfd and RSsh fields.
It can include private anonymous pages, private pages mapped to files It can include private anonymous pages, private pages mapped to files
(including program images and shared libraries) plus shared anonymous pages. (including program images and shared libraries) plus shared anonymous pages.
All such memory is backed by the \*(MS represented separately under SWAP. All such memory is backed by the \*(MS represented separately under SWAP.
@ -791,15 +801,35 @@ modified, act as a dedicated \*(MS and thus will never impact SWAP.
\*(XX. \*(XX.
.TP 4 .TP 4
20.\fB RUID \*(Em Real User Id \fR 20.\fB RSan \*(Em Resident Anonymous Memory Size (KiB) \fR
A subset of resident memory (RES) representing private pages not
mapped to a file.
.TP 4
21.\fB RSfd \*(Em Resident File-Backed Memory Size (KiB) \fR
A subset of resident memory (RES) representing the implicitly shared
pages supporting program images and shared libraries.
It also includes explicit file mappings, both private and shared.
.TP 4
22.\fB RSlk \*(Em Resident Locked Memory Size (KiB) \fR
A subset of resident memory (RES) which cannot be swapped out.
.TP 4
23.\fB RSsh \*(Em Resident Shared Memory Size (KiB) \fR
A subset of resident memory (RES) representing the explicitly shared
anonymous shm*/mmap pages.
.TP 4
24.\fB RUID \*(Em Real User Id \fR
The\fI real\fR user ID. The\fI real\fR user ID.
.TP 4 .TP 4
21.\fB RUSER \*(Em Real User Name \fR 25.\fB RUSER \*(Em Real User Name \fR
The\fI real\fR user name. The\fI real\fR user name.
.TP 4 .TP 4
22.\fB S \*(Em Process Status \fR 26.\fB S \*(Em Process Status \fR
The status of the task which can be one of: The status of the task which can be one of:
\fBD\fR = uninterruptible sleep \fBD\fR = uninterruptible sleep
\fBR\fR = running \fBR\fR = running
@ -814,16 +844,16 @@ Even without a true SMP machine, you may see numerous tasks in this state
depending on \*(We's delay interval and nice value. depending on \*(We's delay interval and nice value.
.TP 4 .TP 4
23.\fB SHR \*(Em Shared Memory Size (KiB) \fR 27.\fB SHR \*(Em Shared Memory Size (KiB) \fR
A subset of resident memory (RES) that may be used by other processes. A subset of resident memory (RES) that may be used by other processes.
It will include shared anonymous pages and shared file-backed pages. It will include shared anonymous pages and shared file-backed pages.
It also includes \fIprivate\fR pages mapped to files representing It also includes private pages mapped to files representing
program images and shared libraries. program images and shared libraries.
\*(XX. \*(XX.
.TP 4 .TP 4
24.\fB SID \*(Em Session Id \fR 28.\fB SID \*(Em Session Id \fR
A session is a collection of process groups (\*(Xa PGRP), A session is a collection of process groups (\*(Xa PGRP),
usually established by the login shell. usually established by the login shell.
A newly forked process joins the session of its creator. A newly forked process joins the session of its creator.
@ -832,11 +862,11 @@ member of the session, called the session leader, which is usually the
login shell. login shell.
.TP 4 .TP 4
25.\fB SUID \*(Em Saved User Id \fR 29.\fB SUID \*(Em Saved User Id \fR
The\fI saved\fR user ID. The\fI saved\fR user ID.
.TP 4 .TP 4
26.\fB SUPGIDS \*(Em Supplementary Group IDs \fR 30.\fB SUPGIDS \*(Em Supplementary Group IDs \fR
The IDs of any supplementary group(s) established at login or The IDs of any supplementary group(s) established at login or
inherited from a task's parent. inherited from a task's parent.
They are displayed in a comma delimited list. They are displayed in a comma delimited list.
@ -849,7 +879,7 @@ Even so, such variable width fields could still suffer truncation.
any truncated data. any truncated data.
.TP 4 .TP 4
27.\fB SUPGRPS \*(Em Supplementary Group Names \fR 31.\fB SUPGRPS \*(Em Supplementary Group Names \fR
The names of any supplementary group(s) established at login or The names of any supplementary group(s) established at login or
inherited from a task's parent. inherited from a task's parent.
They are displayed in a comma delimited list. They are displayed in a comma delimited list.
@ -862,24 +892,24 @@ Even so, such variable width fields could still suffer truncation.
any truncated data. any truncated data.
.TP 4 .TP 4
28.\fB SUSER \*(Em Saved User Name \fR 32.\fB SUSER \*(Em Saved User Name \fR
The\fI saved\fR user name. The\fI saved\fR user name.
.TP 4 .TP 4
29.\fB SWAP \*(Em Swapped Size (KiB) \fR 33.\fB SWAP \*(Em Swapped Size (KiB) \fR
The formerly resident portion of a task's address space written The formerly resident portion of a task's address space written
to the \*(MS when \*(MP becomes over committed. to the \*(MS when \*(MP becomes over committed.
\*(XX. \*(XX.
.TP 4 .TP 4
30.\fB TGID \*(Em Thread Group Id \fR 34.\fB TGID \*(Em Thread Group Id \fR
The ID of the thread group to which a task belongs. The ID of the thread group to which a task belongs.
It is the PID of the thread group leader. It is the PID of the thread group leader.
In kernel terms, it represents those tasks that share an mm_struct. In kernel terms, it represents those tasks that share an mm_struct.
.TP 4 .TP 4
31.\fB TIME \*(Em \*(PU Time \fR 35.\fB TIME \*(Em \*(PU Time \fR
Total \*(PU time the task has used since it started. Total \*(PU time the task has used since it started.
When Cumulative mode is \*O, each process is listed with the \*(Pu When Cumulative mode is \*O, each process is listed with the \*(Pu
time that it and its dead children have used. time that it and its dead children have used.
@ -887,19 +917,19 @@ You toggle Cumulative mode with `S', which is both a \*(CO and an \*(CI.
\*(XC `S' \*(CI for additional information regarding this mode. \*(XC `S' \*(CI for additional information regarding this mode.
.TP 4 .TP 4
32.\fB TIME+ \*(Em \*(PU Time, hundredths \fR 36.\fB TIME+ \*(Em \*(PU Time, hundredths \fR
The same as TIME, but reflecting more granularity through hundredths The same as TIME, but reflecting more granularity through hundredths
of a second. of a second.
.TP 4 .TP 4
33.\fB TPGID \*(Em Tty Process Group Id \fR 37.\fB TPGID \*(Em Tty Process Group Id \fR
The process group ID of the foreground process for the connected tty, The process group ID of the foreground process for the connected tty,
or \-1 if a process is not connected to a terminal. or \-1 if a process is not connected to a terminal.
By convention, this value equals the process ID (\*(Xa PID) of the By convention, this value equals the process ID (\*(Xa PID) of the
process group leader (\*(Xa PGRP). process group leader (\*(Xa PGRP).
.TP 4 .TP 4
34.\fB TTY \*(Em Controlling Tty \fR 38.\fB TTY \*(Em Controlling Tty \fR
The name of the controlling terminal. The name of the controlling terminal.
This is usually the device (serial port, pty, etc.) from which the This is usually the device (serial port, pty, etc.) from which the
process was started, and which it uses for input or output. process was started, and which it uses for input or output.
@ -907,22 +937,22 @@ However, a task need not be associated with a terminal, in which case
you'll see `?' displayed. you'll see `?' displayed.
.TP 4 .TP 4
35.\fB UID \*(Em User Id \fR 39.\fB UID \*(Em User Id \fR
The\fI effective\fR user ID of the task's owner. The\fI effective\fR user ID of the task's owner.
.TP 4 .TP 4
36.\fB USED \*(Em Memory in Use (KiB) \fR 40.\fB USED \*(Em Memory in Use (KiB) \fR
This field represents the non-swapped \*(MP a task is using (RES) plus This field represents the non-swapped \*(MP a task is using (RES) plus
the swapped out portion of its address space (SWAP). the swapped out portion of its address space (SWAP).
\*(XX. \*(XX.
.TP 4 .TP 4
37.\fB USER \*(Em User Name \fR 41.\fB USER \*(Em User Name \fR
The\fI effective\fR user name of the task's owner. The\fI effective\fR user name of the task's owner.
.TP 4 .TP 4
38.\fB VIRT \*(Em Virtual Memory Size (KiB) \fR 42.\fB VIRT \*(Em Virtual Memory Size (KiB) \fR
The total amount of \*(MV used by the task. The total amount of \*(MV used by the task.
It includes all code, data and shared libraries plus pages that have been It includes all code, data and shared libraries plus pages that have been
swapped out and pages that have been mapped but not used. swapped out and pages that have been mapped but not used.
@ -930,20 +960,20 @@ swapped out and pages that have been mapped but not used.
\*(XX. \*(XX.
.TP 4 .TP 4
39.\fB WCHAN \*(Em Sleeping in Function \fR 43.\fB WCHAN \*(Em Sleeping in Function \fR
This field will show the name of the kernel function in which the task This field will show the name of the kernel function in which the task
is currently sleeping. is currently sleeping.
Running tasks will display a dash (`\-') in this column. Running tasks will display a dash (`\-') in this column.
.TP 4 .TP 4
40.\fB nDRT \*(Em Dirty Pages Count \fR 44.\fB nDRT \*(Em Dirty Pages Count \fR
The number of pages that have been modified since they were last The number of pages that have been modified since they were last
written to \*(AS. written to \*(AS.
Dirty pages must be written to \*(AS before the corresponding physical Dirty pages must be written to \*(AS before the corresponding physical
memory location can be used for some other virtual page. memory location can be used for some other virtual page.
.TP 4 .TP 4
41.\fB nMaj \*(Em Major Page Fault Count \fR 45.\fB nMaj \*(Em Major Page Fault Count \fR
The number of\fB major\fR page faults that have occurred for a task. The number of\fB major\fR page faults that have occurred for a task.
A page fault occurs when a process attempts to read from or write to a A page fault occurs when a process attempts to read from or write to a
virtual page that is not currently present in its address space. virtual page that is not currently present in its address space.
@ -951,7 +981,7 @@ A major page fault is when \*(AS access is involved in making that
page available. page available.
.TP 4 .TP 4
42.\fB nMin \*(Em Minor Page Fault count \fR 46.\fB nMin \*(Em Minor Page Fault count \fR
The number of\fB minor\fR page faults that have occurred for a task. The number of\fB minor\fR page faults that have occurred for a task.
A page fault occurs when a process attempts to read from or write to a A page fault occurs when a process attempts to read from or write to a
virtual page that is not currently present in its address space. virtual page that is not currently present in its address space.
@ -959,50 +989,50 @@ A minor page fault does not involve \*(AS access in making that
page available. page available.
.TP 4 .TP 4
43.\fB nTH \*(Em Number of Threads \fR 47.\fB nTH \*(Em Number of Threads \fR
The number of threads associated with a process. The number of threads associated with a process.
.TP 4 .TP 4
44.\fB nsIPC \*(Em IPC namespace \fR 48.\fB nsIPC \*(Em IPC namespace \fR
The Inode of the namespace used to isolate interprocess communication (IPC) The Inode of the namespace used to isolate interprocess communication (IPC)
resources such as System V IPC objects and POSIX message queues. resources such as System V IPC objects and POSIX message queues.
.TP 4 .TP 4
45.\fB nsMNT \*(Em MNT namespace \fR 49.\fB nsMNT \*(Em MNT namespace \fR
The Inode of the namespace used to isolate filesystem mount points thus The Inode of the namespace used to isolate filesystem mount points thus
offering different views of the filesystem hierarchy. offering different views of the filesystem hierarchy.
.TP 4 .TP 4
46.\fB nsNET \*(Em NET namespace \fR 50.\fB nsNET \*(Em NET namespace \fR
The Inode of the namespace used to isolate resources such as network devices, The Inode of the namespace used to isolate resources such as network devices,
IP addresses, IP routing, port numbers, etc. IP addresses, IP routing, port numbers, etc.
.TP 4 .TP 4
47.\fB nsPID \*(Em PID namespace \fR 51.\fB nsPID \*(Em PID namespace \fR
The Inode of the namespace used to isolate process ID numbers The Inode of the namespace used to isolate process ID numbers
meaning they need not remain unique. meaning they need not remain unique.
Thus, each such namespace could have its own `init/systemd' (PID #1) to Thus, each such namespace could have its own `init/systemd' (PID #1) to
manage various initialization tasks and reap orphaned child processes. manage various initialization tasks and reap orphaned child processes.
.TP 4 .TP 4
48.\fB nsUSER \*(Em USER namespace \fR 52.\fB nsUSER \*(Em USER namespace \fR
The Inode of the namespace used to isolate the user and group ID numbers. The Inode of the namespace used to isolate the user and group ID numbers.
Thus, a process could have a normal unprivileged user ID outside a user Thus, a process could have a normal unprivileged user ID outside a user
namespace while having a user ID of 0, with full root privileges, inside namespace while having a user ID of 0, with full root privileges, inside
that namespace. that namespace.
.TP 4 .TP 4
49.\fB nsUTS \*(Em UTS namespace \fR 53.\fB nsUTS \*(Em UTS namespace \fR
The Inode of the namespace used to isolate hostname and NIS domain name. The Inode of the namespace used to isolate hostname and NIS domain name.
UTS simply means "UNIX Time-sharing System". UTS simply means "UNIX Time-sharing System".
.TP 4 .TP 4
50.\fB vMj \*(Em Major Page Fault Count Delta\fR 54.\fB vMj \*(Em Major Page Fault Count Delta\fR
The number of\fB major\fR page faults that have occurred since the The number of\fB major\fR page faults that have occurred since the
last update (see nMaj). last update (see nMaj).
.TP 4 .TP 4
51.\fB vMn \*(Em Minor Page Fault Count Delta\fR 55.\fB vMn \*(Em Minor Page Fault Count Delta\fR
The number of\fB minor\fR page faults that have occurred since the The number of\fB minor\fR page faults that have occurred since the
last update (see nMin). last update (see nMin).