procps/procps-ng-3.3.10-slab.patch

127 lines
5.1 KiB
Diff

---
library/meminfo.c | 7 ++++++-
man/free.1 | 6 ++++++
src/free.c | 7 ++++++-
src/vmstat.c | 7 ++++++-
4 files changed, 24 insertions(+), 3 deletions(-)
--- library/meminfo.c
+++ library/meminfo.c 2023-09-12 12:08:41.033738450 +0000
@@ -3,6 +3,7 @@
*
* Copyright © 2015-2023 Jim Warner <james.warner@comcast.net>
* Copyright © 2015-2023 Craig Small <csmall@dropbear.xyz>
+ * Copyright © 2008 Bart Van Assche.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -640,6 +641,7 @@ static int meminfo_read_failed (
int size;
unsigned long *valptr;
signed long mem_used;
+ const char *ev;
// remember history from last time around
memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data));
@@ -692,7 +694,10 @@ static int meminfo_read_failed (
if (0 == mHr(MemAvailable))
mHr(MemAvailable) = mHr(MemFree);
- mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable);
+ if ((ev=getenv("PS_FULL_CACHE")))
+ mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable) + mHr(NFS_Unstable);
+ else
+ mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable);
/* if 'available' is greater than 'total' or our calculation of mem_used
overflows, that's symptomatic of running within a lxc container where
--- man/free.1
+++ man/free.1 2023-09-12 12:08:41.029738522 +0000
@@ -110,6 +110,12 @@ Switch to the wide mode. The wide mode p
than 80 characters. In this mode \fBbuffers\fR and \fBcache\fR
are reported in two separate columns.
.TP
+\fB\-C\fR, \fB\-\-full\-cache\fR
+Add to the plain \fBCached\fR in-memory cache for files also more cache lines as
+the \fBNFS_Unstable\fR pages sent to the server, but not yet committed to stable storage
+and the \fBSwapCached\fR memory that once was swapped out but is swapped back.
+Can be also enabled by the environment variable \fBPS_FULL_CACHE\fR.
+.TP
\fB\-c\fR, \fB\-\-count\fR \fIcount\fR
Display the result
.I count
--- src/free.c
+++ src/free.c 2023-09-12 12:10:26.647842455 +0000
@@ -92,6 +92,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -v, --committed show committed memory and commit limit\n"), out);
fputs(_(" -s N, --seconds N repeat printing every N seconds\n"), out);
fputs(_(" -c N, --count N repeat printing N times, then exit\n"), out);
+ fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_(" --help display this help and exit\n"), out);
@@ -244,6 +245,7 @@ int main(int argc, char **argv)
{ "committed", no_argument, NULL, 'v' },
{ "seconds", required_argument, NULL, 's' },
{ "count", required_argument, NULL, 'c' },
+ { "full-cache",no_argument, NULL, 'C' },
{ "wide", no_argument, NULL, 'w' },
{ "help", no_argument, NULL, HELP_OPTION },
{ "version", no_argument, NULL, 'V' },
@@ -263,7 +265,7 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- while ((c = getopt_long(argc, argv, "bkmghlLtvc:ws:V", longopts, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "bkmghlLtvCc:ws:V", longopts, NULL)) != -1)
switch (c) {
case 'b':
check_unit_set(&unit_set);
@@ -352,6 +354,9 @@ int main(int argc, char **argv)
case 'w':
flags |= FREE_WIDE;
break;
+ case 'C':
+ setenv("PS_FULL_CACHE", "yes", 1);
+ break;
case HELP_OPTION:
usage(stdout);
case 'V':
--- src/vmstat.c
+++ src/vmstat.c 2023-09-12 12:08:41.033738450 +0000
@@ -230,6 +230,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -p, --partition <dev> partition specific statistics\n"), out);
fputs(_(" -S, --unit <char> define display unit\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
+ fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out);
fputs(_(" -t, --timestamp show timestamp\n"), out);
fputs(_(" -y, --no-first skips first line of output\n"), out);
fputs(USAGE_SEPARATOR, out);
@@ -951,6 +952,7 @@ int main(int argc, char *argv[])
{"partition", required_argument, NULL, 'p'},
{"unit", required_argument, NULL, 'S'},
{"wide", no_argument, NULL, 'w'},
+ {"full-cache", no_argument, NULL, 'C'},
{"timestamp", no_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
@@ -967,7 +969,7 @@ int main(int argc, char *argv[])
atexit(close_stdout);
while ((c =
- getopt_long(argc, argv, "afmnsdDp:S:wthVy", longopts, NULL)) != -1)
+ getopt_long(argc, argv, "aCfmnsdDp:S:wthVy", longopts, NULL)) != -1)
switch (c) {
case 'V':
printf(PROCPS_NG_VERSION);
@@ -1034,6 +1036,9 @@ int main(int argc, char *argv[])
case 't':
t_option = 1;
break;
+ case 'C':
+ setenv("PS_FULL_CACHE", "yes", 1);
+ break;
case 'y':
/* Don't display stats since system restart */
y_option = 1;