[RFC,v5,3/8] mm: Display inflated memory to users
Commit Message
Add InflatedTotal and InflatedFree to /proc/meminfo
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
---
Documentation/filesystems/proc.rst | 6 ++++++
fs/proc/meminfo.c | 10 ++++++++++
2 files changed, 16 insertions(+)
@@ -992,6 +992,8 @@ Example output. You may not have all of these fields.
VmallocUsed: 40444 kB
VmallocChunk: 0 kB
Percpu: 29312 kB
+ InflatedTotal: 2097152 kB
+ InflatedFree: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 4149248 kB
ShmemHugePages: 0 kB
@@ -1142,6 +1144,10 @@ VmallocChunk
Percpu
Memory allocated to the percpu allocator used to back percpu
allocations. This stat excludes the cost of metadata.
+InflatedTotal and InflatedFree
+ Amount of memory that is inflated by the balloon driver.
+ Due to differences among the drivers inflated memory
+ is subtracted from TotalRam or from MemFree.
HardwareCorrupted
The amount of RAM/memory in KB, the kernel identifies as
corrupted.
@@ -16,6 +16,9 @@
#ifdef CONFIG_CMA
#include <linux/cma.h>
#endif
+#ifdef CONFIG_MEMORY_BALLOON
+#include <linux/balloon.h>
+#endif
#include <asm/page.h>
#include "internal.h"
@@ -155,6 +158,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
global_zone_page_state(NR_FREE_CMA_PAGES));
#endif
+#ifdef CONFIG_MEMORY_BALLOON
+ seq_printf(m, "InflatedTotal: %8ld kB\n",
+ atomic_long_read(&mem_balloon_inflated_total_kb));
+ seq_printf(m, "InflatedFree: %8ld kB\n",
+ atomic_long_read(&mem_balloon_inflated_free_kb));
+#endif
+
hugetlb_report_meminfo(m);
arch_report_meminfo(m);