From 29079d35e578e24a8b64250b8340d152d2c63fd5 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 2 Jun 2016 00:00:00 -0500 Subject: [PATCH] top: accommodate the loss of that OOMEM_ENABLE #define Now that the conditional OOMEM_ENABLE has been removed and all users exposed to those 'out of memory' fields, it's about time we added them to the top man document. Signed-off-by: Jim Warner --- top/top.1 | 98 +++++++++++++++++++++++++++++---------------------- top/top.c | 21 ++--------- top/top.h | 14 ++------ top/top_nls.c | 14 ++++---- 4 files changed, 67 insertions(+), 80 deletions(-) diff --git a/top/top.1 b/top/top.1 index c0cf6f7a..a565f4f3 100644 --- a/top/top.1 +++ b/top/top.1 @@ -69,7 +69,7 @@ . .\" Document ///////////////////////////////////////////////////////////// .\" ---------------------------------------------------------------------- -.TH TOP 1 "April 2016" "procps-ng" "User Commands" +.TH TOP 1 "May 2016" "procps-ng" "User Commands" .\" ---------------------------------------------------------------------- .\" ---------------------------------------------------------------------- @@ -735,7 +735,19 @@ Zero in this field simply means priority will not be adjusted in determining a task's dispatch-ability. .TP 4 -13.\fB P \*(Em Last used \*(PU (SMP) \fR +13.\fB OOMa \*(Em Out of Memory Adjustment Factor \fR +The value, ranging from -1000 to +1000, added to the current out of memory +score (OOMs) which is then used to determine which task to kill when memory +is exhausted. + +.TP 4 +14.\fB OOMs \*(Em Out of Memory Score \fR +The value, ranging from 0 to +1000, used to select task(s) to kill when memory +is exhausted. +Zero translates to `never kill' whereas 1000 means `always kill'. + +.TP 4 +15.\fB P \*(Em Last used \*(PU (SMP) \fR A number representing the last used processor. In a true SMP environment this will likely change frequently since the kernel intentionally uses weak affinity. @@ -744,7 +756,7 @@ processes to change \*(PUs more often (because of the extra demand for \*(Pu time). .TP 4 -14.\fB PGRP \*(Em Process Group Id \fR +16.\fB PGRP \*(Em Process Group Id \fR Every process is member of a unique process group which is used for distribution of signals and by terminals to arbitrate requests for their input and output. @@ -754,7 +766,7 @@ By convention, this value equals the process ID (\*(Xa PID) of the first member of a process group, called the process group leader. .TP 4 -15.\fB PID \*(Em Process Id \fR +17.\fB PID \*(Em Process Id \fR The task's unique process ID, which periodically wraps, though never restarting at zero. In kernel terms, it is a dispatchable entity defined by a task_struct. @@ -765,11 +777,11 @@ a thread group ID for the thread group leader (\*(Xa TGID); and a TTY process group ID for the process group leader (\*(Xa TPGID). .TP 4 -16.\fB PPID \*(Em Parent Process Id \fR +18.\fB PPID \*(Em Parent Process Id \fR The process ID (pid) of a task's parent. .TP 4 -17.\fB PR \*(Em Priority \fR +19.\fB PR \*(Em Priority \fR The scheduling priority of the task. If you see `rt' in this field, it means the task is running under real time scheduling priority. @@ -779,7 +791,7 @@ the operating itself was not preemptible. And while the 2.6 kernel can be made mostly preemptible, it is not always so. .TP 4 -18.\fB RES \*(Em Resident Memory Size (KiB) \fR +20.\fB RES \*(Em Resident Memory Size (KiB) \fR A subset of the virtual address space (VIRT) representing the non-swapped \*(MP a task is currently using. It is also the sum of the RSan, RSfd and RSsh fields. @@ -794,35 +806,35 @@ modified, act as a dedicated \*(MS and thus will never impact SWAP. \*(XX. .TP 4 -19.\fB RSan \*(Em Resident Anonymous Memory Size (KiB) \fR +21.\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 -20.\fB RSfd \*(Em Resident File-Backed Memory Size (KiB) \fR +22.\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 -21.\fB RSlk \*(Em Resident Locked Memory Size (KiB) \fR +23.\fB RSlk \*(Em Resident Locked Memory Size (KiB) \fR A subset of resident memory (RES) which cannot be swapped out. .TP 4 -22.\fB RSsh \*(Em Resident Shared Memory Size (KiB) \fR +24.\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 -23.\fB RUID \*(Em Real User Id \fR +25.\fB RUID \*(Em Real User Id \fR The\fI real\fR user ID. .TP 4 -24.\fB RUSER \*(Em Real User Name \fR +26.\fB RUSER \*(Em Real User Name \fR The\fI real\fR user name. .TP 4 -25.\fB S \*(Em Process Status \fR +27.\fB S \*(Em Process Status \fR The status of the task which can be one of: \fBD\fR = uninterruptible sleep \fBR\fR = running @@ -837,7 +849,7 @@ Even without a true SMP machine, you may see numerous tasks in this state depending on \*(We's delay interval and nice value. .TP 4 -26.\fB SHR \*(Em Shared Memory Size (KiB) \fR +28.\fB SHR \*(Em Shared Memory Size (KiB) \fR 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 also includes private pages mapped to files representing @@ -846,7 +858,7 @@ program images and shared libraries. \*(XX. .TP 4 -27.\fB SID \*(Em Session Id \fR +29.\fB SID \*(Em Session Id \fR A session is a collection of process groups (\*(Xa PGRP), usually established by the login shell. A newly forked process joins the session of its creator. @@ -855,11 +867,11 @@ member of the session, called the session leader, which is usually the login shell. .TP 4 -28.\fB SUID \*(Em Saved User Id \fR +30.\fB SUID \*(Em Saved User Id \fR The\fI saved\fR user ID. .TP 4 -29.\fB SUPGIDS \*(Em Supplementary Group IDs \fR +31.\fB SUPGIDS \*(Em Supplementary Group IDs \fR The IDs of any supplementary group(s) established at login or inherited from a task's parent. They are displayed in a comma delimited list. @@ -872,7 +884,7 @@ Even so, such variable width fields could still suffer truncation. any truncated data. .TP 4 -30.\fB SUPGRPS \*(Em Supplementary Group Names \fR +32.\fB SUPGRPS \*(Em Supplementary Group Names \fR The names of any supplementary group(s) established at login or inherited from a task's parent. They are displayed in a comma delimited list. @@ -885,24 +897,24 @@ Even so, such variable width fields could still suffer truncation. any truncated data. .TP 4 -31.\fB SUSER \*(Em Saved User Name \fR +33.\fB SUSER \*(Em Saved User Name \fR The\fI saved\fR user name. .TP 4 -32.\fB SWAP \*(Em Swapped Size (KiB) \fR +34.\fB SWAP \*(Em Swapped Size (KiB) \fR The formerly resident portion of a task's address space written to the \*(MS when \*(MP becomes over committed. \*(XX. .TP 4 -33.\fB TGID \*(Em Thread Group Id \fR +35.\fB TGID \*(Em Thread Group Id \fR The ID of the thread group to which a task belongs. It is the PID of the thread group leader. In kernel terms, it represents those tasks that share an mm_struct. .TP 4 -34.\fB TIME \*(Em \*(PU Time \fR +36.\fB TIME \*(Em \*(PU Time \fR Total \*(PU time the task has used since it started. When Cumulative mode is \*O, each process is listed with the \*(Pu time that it and its dead children have used. @@ -910,19 +922,19 @@ You toggle Cumulative mode with `S', which is both a \*(CO and an \*(CI. \*(XC `S' \*(CI for additional information regarding this mode. .TP 4 -35.\fB TIME+ \*(Em \*(PU Time, hundredths \fR +37.\fB TIME+ \*(Em \*(PU Time, hundredths \fR The same as TIME, but reflecting more granularity through hundredths of a second. .TP 4 -36.\fB TPGID \*(Em Tty Process Group Id \fR +38.\fB TPGID \*(Em Tty Process Group Id \fR The process group ID of the foreground process for the connected tty, or \-1 if a process is not connected to a terminal. By convention, this value equals the process ID (\*(Xa PID) of the process group leader (\*(Xa PGRP). .TP 4 -37.\fB TTY \*(Em Controlling Tty \fR +39.\fB TTY \*(Em Controlling Tty \fR The name of the controlling terminal. This is usually the device (serial port, pty, etc.) from which the process was started, and which it uses for input or output. @@ -930,22 +942,22 @@ However, a task need not be associated with a terminal, in which case you'll see `?' displayed. .TP 4 -38.\fB UID \*(Em User Id \fR +40.\fB UID \*(Em User Id \fR The\fI effective\fR user ID of the task's owner. .TP 4 -39.\fB USED \*(Em Memory in Use (KiB) \fR +41.\fB USED \*(Em Memory in Use (KiB) \fR This field represents the non-swapped \*(MP a task is using (RES) plus the swapped out portion of its address space (SWAP). \*(XX. .TP 4 -40.\fB USER \*(Em User Name \fR +42.\fB USER \*(Em User Name \fR The\fI effective\fR user name of the task's owner. .TP 4 -41.\fB VIRT \*(Em Virtual Memory Size (KiB) \fR +43.\fB VIRT \*(Em Virtual Memory Size (KiB) \fR The total amount of \*(MV used by the task. It includes all code, data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used. @@ -953,20 +965,20 @@ swapped out and pages that have been mapped but not used. \*(XX. .TP 4 -42.\fB WCHAN \*(Em Sleeping in Function \fR +44.\fB WCHAN \*(Em Sleeping in Function \fR This field will show the name of the kernel function in which the task is currently sleeping. Running tasks will display a dash (`\-') in this column. .TP 4 -43.\fB nDRT \*(Em Dirty Pages Count \fR +45.\fB nDRT \*(Em Dirty Pages Count \fR The number of pages that have been modified since they were last written to \*(AS. Dirty pages must be written to \*(AS before the corresponding physical memory location can be used for some other virtual page. .TP 4 -44.\fB nMaj \*(Em Major Page Fault Count \fR +46.\fB nMaj \*(Em Major Page Fault Count \fR 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 virtual page that is not currently present in its address space. @@ -974,7 +986,7 @@ A major page fault is when \*(AS access is involved in making that page available. .TP 4 -45.\fB nMin \*(Em Minor Page Fault count \fR +47.\fB nMin \*(Em Minor Page Fault count \fR 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 virtual page that is not currently present in its address space. @@ -982,50 +994,50 @@ A minor page fault does not involve \*(AS access in making that page available. .TP 4 -46.\fB nTH \*(Em Number of Threads \fR +48.\fB nTH \*(Em Number of Threads \fR The number of threads associated with a process. .TP 4 -47.\fB nsIPC \*(Em IPC namespace \fR +49.\fB nsIPC \*(Em IPC namespace \fR The Inode of the namespace used to isolate interprocess communication (IPC) resources such as System V IPC objects and POSIX message queues. .TP 4 -48.\fB nsMNT \*(Em MNT namespace \fR +50.\fB nsMNT \*(Em MNT namespace \fR The Inode of the namespace used to isolate filesystem mount points thus offering different views of the filesystem hierarchy. .TP 4 -49.\fB nsNET \*(Em NET namespace \fR +51.\fB nsNET \*(Em NET namespace \fR The Inode of the namespace used to isolate resources such as network devices, IP addresses, IP routing, port numbers, etc. .TP 4 -50.\fB nsPID \*(Em PID namespace \fR +52.\fB nsPID \*(Em PID namespace \fR The Inode of the namespace used to isolate process ID numbers meaning they need not remain unique. Thus, each such namespace could have its own `init/systemd' (PID #1) to manage various initialization tasks and reap orphaned child processes. .TP 4 -51.\fB nsUSER \*(Em USER namespace \fR +53.\fB nsUSER \*(Em USER namespace \fR 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 namespace while having a user ID of 0, with full root privileges, inside that namespace. .TP 4 -52.\fB nsUTS \*(Em UTS namespace \fR +54.\fB nsUTS \*(Em UTS namespace \fR The Inode of the namespace used to isolate hostname and NIS domain name. UTS simply means "UNIX Time-sharing System". .TP 4 -53.\fB vMj \*(Em Major Page Fault Count Delta\fR +55.\fB vMj \*(Em Major Page Fault Count Delta\fR The number of\fB major\fR page faults that have occurred since the last update (see nMaj). .TP 4 -54.\fB vMn \*(Em Minor Page Fault Count Delta\fR +56.\fB vMn \*(Em Minor Page Fault Count Delta\fR The number of\fB minor\fR page faults that have occurred since the last update (see nMin). diff --git a/top/top.c b/top/top.c index db3ed6ef..b9ce1a12 100644 --- a/top/top.c +++ b/top/top.c @@ -275,10 +275,8 @@ SCB_NUM1(NS3, ns[NETNS]) SCB_NUM1(NS4, ns[PIDNS]) SCB_NUM1(NS5, ns[USERNS]) SCB_NUM1(NS6, ns[UTSNS]) -#ifdef OOMEM_ENABLE SCB_NUM1(OOA, oom_adj) SCB_NUM1(OOM, oom_score) -#endif SCB_NUMx(PGD, pgrp) SCB_NUMx(PID, tid) SCB_NUMx(PPD, ppid) @@ -1685,6 +1683,7 @@ end_justifies: #define L_SUPGRP PROC_FILLSTATUS | PROC_FILLSUPGRP #define L_NS PROC_FILLNS #define L_LXC PROC_FILL_LXC +#define L_OOM PROC_FILLOOM // make 'none' non-zero (used to be important to Frames_libflags) #define L_NONE PROC_SPARE_1 // from either 'stat' or 'status' (preferred), via bits not otherwise used @@ -1765,12 +1764,8 @@ static FLD_t Fieldstab[] = { { -1, -1, A_left, SF(SGD), L_status }, { -1, -1, A_left, SF(SGN), L_SUPGRP }, { 0, -1, A_right, SF(TGD), L_status }, -#ifdef OOMEM_ENABLE -#define L_oom PROC_FILLOOM - { 3, -1, A_right, SF(OOA), L_oom }, - { 8, -1, A_right, SF(OOM), L_oom }, -#undef L_oom -#endif + { 5, -1, A_right, SF(OOA), L_OOM }, + { 4, -1, A_right, SF(OOM), L_OOM }, { -1, -1, A_left, SF(ENV), L_ENVIRON }, { 3, -1, A_right, SF(FV1), L_stat }, { 3, -1, A_right, SF(FV2), L_stat }, @@ -3375,11 +3370,7 @@ static int config_cvt (WIN_t *q) { #undef old_Show_THREAD }; static const char fields_src[] = CVT_FIELDS; -#ifdef OOMEM_ENABLE char fields_dst[PFLAGSSIZ], *p1, *p2; -#else - char fields_dst[PFLAGSSIZ]; -#endif int i, j, x; // first we'll touch up this window's winflags... @@ -3398,14 +3389,12 @@ static int config_cvt (WIN_t *q) { if (j > CVT_FLDMAX) return 1; strcpy(fields_dst, fields_src); -#ifdef OOMEM_ENABLE /* all other fields represent the 'on' state with a capitalized version of a particular qwerty key. for the 2 additional suse out-of-memory fields it makes perfect sense to do the exact opposite, doesn't it? in any case, we must turn them 'off' temporarily... */ if ((p1 = strchr(q->rc.fieldscur, '['))) *p1 = '{'; if ((p2 = strchr(q->rc.fieldscur, '\\'))) *p2 = '|'; -#endif for (i = 0; i < j; i++) { int c = q->rc.fieldscur[i]; x = tolower(c) - 'a'; @@ -3415,11 +3404,9 @@ static int config_cvt (WIN_t *q) { if (isupper(c)) FLDon(fields_dst[i]); } -#ifdef OOMEM_ENABLE // if we turned any suse only fields off, turn 'em back on OUR way... if (p1) FLDon(fields_dst[p1 - q->rc.fieldscur]); if (p2) FLDon(fields_dst[p2 - q->rc.fieldscur]); -#endif strcpy(q->rc.fieldscur, fields_dst); // lastly, we must adjust the old sort field enum... @@ -5416,14 +5403,12 @@ static const char *task_show (const WIN_t *q, const proc_t *p) { cp = make_num(ino, W, Jn, i, 1); } break; -#ifdef OOMEM_ENABLE case EU_OOA: cp = make_num(p->oom_adj, W, Jn, AUTOX_NO, 1); break; case EU_OOM: cp = make_num(p->oom_score, W, Jn, AUTOX_NO, 1); break; -#endif case EU_PGD: cp = make_num(p->pgrp, W, Jn, AUTOX_NO, 0); break; diff --git a/top/top.h b/top/top.h index 453d42a7..c95688e0 100644 --- a/top/top.h +++ b/top/top.h @@ -26,7 +26,6 @@ //#define BOOST_PERCNT /* enable extra precision for two % fields */ //#define NOBOOST_MEMS /* disable extra precision for mem fields */ //#define NUMA_DISABLE /* disable summary area NUMA/Nodes display */ -//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */ //#define ORIG_TOPDEFS /* with no rcfile retain original defaults */ //#define SIGNALS_LESS /* favor reduced signal load over response */ @@ -198,9 +197,7 @@ enum pflag { EU_FL1, EU_FL2, EU_DRT, EU_STA, EU_CMD, EU_WCH, EU_FLG, EU_CGR, EU_SGD, EU_SGN, EU_TGD, -#ifdef OOMEM_ENABLE EU_OOA, EU_OOM, -#endif EU_ENV, EU_FV1, EU_FV2, EU_USE, @@ -608,16 +605,11 @@ typedef struct WIN_t { #define JOB_FIELDS "¥¦¹·º(³´Ä»½@<§Å)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H #define MEM_FIELDS "¥º»<½¾¿ÀÁMBNÃD34·Å&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[" RCF_PLUS_H #define USR_FIELDS "¥¦§¨ª°¹·ºÄÅ)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H -#ifdef OOMEM_ENABLE - // the suse old top fields ( 'a'-'z' + '{|' ) in positions 0-27 - // ( the extra chars above represent the 'off' state ) + // old top fields ( 'a'-'z' ) in positions 0-25 + // other suse old top fields ( '{|' ) in positions 26-27 #define CVT_FIELDS "%&*'(-0346789:;<=>?@ACDEFGML)+,./125BHIJKNOPQRSTUVWXYZ[" #define CVT_FLDMAX 28 -#else - // other old top fields ( 'a'-'z' ) in positions 0-25 -#define CVT_FIELDS "%&*'(-0346789:;<=>?@ACDEFG)+,./125BHIJKLMNOPQRSTUVWXYZ[" -#define CVT_FLDMAX 26 -#endif + /* The default values for the local config file */ #define DEF_RCFILE { \ diff --git a/top/top_nls.c b/top/top_nls.c index 1ac239fa..16d0889f 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -237,14 +237,12 @@ static void build_two_nlstabs (void) { /* Translation Hint: maximum 'TGID' = 5 */ Head_nlstab[EU_TGD] = _("TGID"); Desc_nlstab[EU_TGD] = _("Thread Group Id"); -#ifdef OOMEM_ENABLE -/* Translation Hint: maximum 'Adj' = 3 */ - Head_nlstab[EU_OOA] = _("Adj"); - Desc_nlstab[EU_OOA] = _("oom_adjustment (2^X)"); -/* Translation Hint: maximum 'Badness' = 7 */ - Head_nlstab[EU_OOM] = _("Badness"); - Desc_nlstab[EU_OOM] = _("oom_score (badness)"); -#endif +/* Translation Hint: maximum 'OOMa' = 5 */ + Head_nlstab[EU_OOA] = _("OOMa"); + Desc_nlstab[EU_OOA] = _("OOMEM Adjustment"); +/* Translation Hint: maximum 'OOMs' = 4 */ + Head_nlstab[EU_OOM] = _("OOMs"); + Desc_nlstab[EU_OOM] = _("OOMEM Score current"); /* Translation Hint: maximum 'ENVIRON' = 7 */ Head_nlstab[EU_ENV] = _("ENVIRON"); /* Translation Hint: the abbreviation 'vars' below is shorthand for