summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Neira <cneirabustos@gmail.com>2020-03-25 08:54:43 -0300
committerGitHub <noreply@github.com>2020-03-25 11:54:43 +0000
commit94eb3b821b728e8dc462bb87d35b5f55b5835edc (patch)
treee2016e4eaeb107090dbc5e2f291f9b0b0680dd95
parent27d7732c0a98cb6bb6f69ad39be753b41fb41ffe (diff)
downloadillumos-joyent-release-20200326.tar.gz
OS-8145 Add MemAvailable to lx procfs (#267)release-20200326
Reviewed by: John Levon <john.levon@joyent.com> Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r--usr/src/uts/common/brand/lx/procfs/lx_prvnops.c36
-rw-r--r--usr/src/uts/common/fs/lxproc/lxpr_vnops.c30
2 files changed, 38 insertions, 28 deletions
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
index 90e8fbe4d5..ba32aaf04e 100644
--- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
+++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
@@ -3989,24 +3989,32 @@ lxpr_read_meminfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
* wing it and kill a random process if they run out of backing store
* for virtual memory. Our swap reservation doesn't translate to that
* model, so just inform the caller that no swap is being used.
+ *
+ * MemAvailable
+ * MemAvailable entry is available since Linux Kernel +3.14, is an
+ * estimate of how much memory is available for starting new applications,
+ * without swapping. In lxbrand we will always return the available free
+ * memory as an estimate of this value.
*/
lxpr_uiobuf_printf(uiobuf,
- "MemTotal: %8lu kB\n"
- "MemFree: %8lu kB\n"
- "MemShared: %8u kB\n"
- "Buffers: %8u kB\n"
- "Cached: %8u kB\n"
- "SwapCached:%8u kB\n"
- "Active: %8u kB\n"
- "Inactive: %8u kB\n"
- "HighTotal: %8u kB\n"
- "HighFree: %8u kB\n"
- "LowTotal: %8u kB\n"
- "LowFree: %8u kB\n"
- "SwapTotal: %8lu kB\n"
- "SwapFree: %8lu kB\n",
+ "MemTotal: %8lu kB\n"
+ "MemFree: %8lu kB\n"
+ "MemAvailable: %8lu kB\n"
+ "MemShared: %8u kB\n"
+ "Buffers: %8u kB\n"
+ "Cached: %8u kB\n"
+ "SwapCached: %8u kB\n"
+ "Active: %8u kB\n"
+ "Inactive: %8u kB\n"
+ "HighTotal: %8u kB\n"
+ "HighFree: %8u kB\n"
+ "LowTotal: %8u kB\n"
+ "LowFree: %8u kB\n"
+ "SwapTotal: %8lu kB\n"
+ "SwapFree: %8lu kB\n",
btok(total_mem), /* MemTotal */
btok(free_mem), /* MemFree */
+ btok(free_mem), /* MemAvailable */
0, /* MemShared */
0, /* Buffers */
0, /* Cached */
diff --git a/usr/src/uts/common/fs/lxproc/lxpr_vnops.c b/usr/src/uts/common/fs/lxproc/lxpr_vnops.c
index 9bcc0f7e8b..60b3d52f09 100644
--- a/usr/src/uts/common/fs/lxproc/lxpr_vnops.c
+++ b/usr/src/uts/common/fs/lxproc/lxpr_vnops.c
@@ -1472,24 +1472,26 @@ lxpr_read_meminfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
" total: used: free: shared: buffers: cached:\n"
"Mem: %8lu %8lu %8lu %8u %8u %8u\n"
"Swap: %8lu %8lu %8lu\n"
- "MemTotal: %8lu kB\n"
- "MemFree: %8lu kB\n"
- "MemShared: %8u kB\n"
- "Buffers: %8u kB\n"
- "Cached: %8u kB\n"
- "SwapCached:%8u kB\n"
- "Active: %8u kB\n"
- "Inactive: %8u kB\n"
- "HighTotal: %8u kB\n"
- "HighFree: %8u kB\n"
- "LowTotal: %8u kB\n"
- "LowFree: %8u kB\n"
- "SwapTotal: %8lu kB\n"
- "SwapFree: %8lu kB\n",
+ "MemTotal: %8lu kB\n"
+ "MemFree: %8lu kB\n"
+ "MemAvailable: %8lu kB\n"
+ "MemShared: %8u kB\n"
+ "Buffers: %8u kB\n"
+ "Cached: %8u kB\n"
+ "SwapCached: %8u kB\n"
+ "Active: %8u kB\n"
+ "Inactive: %8u kB\n"
+ "HighTotal: %8u kB\n"
+ "HighFree: %8u kB\n"
+ "LowTotal: %8u kB\n"
+ "LowFree: %8u kB\n"
+ "SwapTotal: %8lu kB\n"
+ "SwapFree: %8lu kB\n",
total_mem, total_mem - free_mem, free_mem, 0, 0, 0,
total_swap, used_swap, total_swap - used_swap,
btok(total_mem), /* MemTotal */
btok(free_mem), /* MemFree */
+ btok(free_mem), /* MemAvailable */
0, /* MemShared */
0, /* Buffers */
0, /* Cached */