From: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: kernel@openvz.org,
Alexander Atanasov <alexander.atanasov@virtuozzo.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: [PATCH v3 3/4] Display inflated memory to users
Date: Mon, 22 Aug 2022 14:37:46 +0300 [thread overview]
Message-ID: <20220822113747.3630776-4-alexander.atanasov@virtuozzo.com> (raw)
In-Reply-To: <20220822113747.3630776-1-alexander.atanasov@virtuozzo.com>
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(+)
diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
index e7aafc82be99..690e1b90ffee 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -991,6 +991,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
@@ -1138,6 +1140,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.
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 6e89f0e2fd20..7182886efdbf 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -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"
@@ -153,6 +156,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);
--
2.31.1
next prev parent reply other threads:[~2022-08-22 11:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220822113747.3630776-1-alexander.atanasov@virtuozzo.com>
2022-08-22 11:37 ` [PATCH v3 1/4] Make place for common balloon code Alexander Atanasov
2022-08-22 15:58 ` Nadav Amit
2022-08-22 11:37 ` [PATCH v3 2/4] Enable balloon drivers to report inflated memory Alexander Atanasov
2022-08-22 11:37 ` Alexander Atanasov [this message]
2022-08-22 11:37 ` [PATCH v3 4/4] drivers: virtio: balloon - update " Alexander Atanasov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220822113747.3630776-4-alexander.atanasov@virtuozzo.com \
--to=alexander.atanasov@virtuozzo.com \
--cc=corbet@lwn.net \
--cc=kernel@openvz.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).