From: Nico Pache <npache@redhat.com>
To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux.dev, xen-devel@lists.xenproject.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
cgroups@vger.kernel.org
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
decui@microsoft.com, jerrin.shaji-george@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, arnd@arndb.de,
gregkh@linuxfoundation.org, mst@redhat.com, david@redhat.com,
jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, jgross@suse.com, sstabellini@kernel.org,
oleksandr_tyshchenko@epam.com, akpm@linux-foundation.org,
hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, muchun.song@linux.dev, nphamcs@gmail.com,
yosry.ahmed@linux.dev, kanchana.p.sridhar@intel.com,
alexander.atanasov@virtuozzo.com
Subject: [RFC 1/5] meminfo: add a per node counter for balloon drivers
Date: Tue, 11 Mar 2025 18:06:56 -0600 [thread overview]
Message-ID: <20250312000700.184573-2-npache@redhat.com> (raw)
In-Reply-To: <20250312000700.184573-1-npache@redhat.com>
Add NR_BALLOON_PAGES counter to track memory used by balloon drivers and
expose it through /proc/meminfo and other memory reporting interfaces.
Signed-off-by: Nico Pache <npache@redhat.com>
---
fs/proc/meminfo.c | 2 ++
include/linux/mmzone.h | 1 +
mm/memcontrol.c | 1 +
mm/show_mem.c | 4 +++-
mm/vmstat.c | 1 +
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 8ba9b1472390..83be312159c9 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -162,6 +162,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
show_val_kb(m, "Unaccepted: ",
global_zone_page_state(NR_UNACCEPTED));
#endif
+ show_val_kb(m, "Balloon: ",
+ global_node_page_state(NR_BALLOON_PAGES));
hugetlb_report_meminfo(m);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9540b41894da..71d3ff19267a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -223,6 +223,7 @@ enum node_stat_item {
#ifdef CONFIG_HUGETLB_PAGE
NR_HUGETLB,
#endif
+ NR_BALLOON_PAGES,
NR_VM_NODE_STAT_ITEMS
};
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4de6acb9b8ec..182b44646bfa 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1377,6 +1377,7 @@ static const struct memory_stat memory_stats[] = {
#ifdef CONFIG_HUGETLB_PAGE
{ "hugetlb", NR_HUGETLB },
#endif
+ { "nr_balloon_pages", NR_BALLOON_PAGES },
/* The memory events */
{ "workingset_refault_anon", WORKINGSET_REFAULT_ANON },
diff --git a/mm/show_mem.c b/mm/show_mem.c
index 43afb56abbd3..6af13bcd2ab3 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -260,6 +260,7 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
" pagetables:%lukB"
" sec_pagetables:%lukB"
" all_unreclaimable? %s"
+ " Balloon:%lukB"
"\n",
pgdat->node_id,
K(node_page_state(pgdat, NR_ACTIVE_ANON)),
@@ -285,7 +286,8 @@ static void show_free_areas(unsigned int filter, nodemask_t *nodemask, int max_z
#endif
K(node_page_state(pgdat, NR_PAGETABLE)),
K(node_page_state(pgdat, NR_SECONDARY_PAGETABLE)),
- str_yes_no(pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES));
+ str_yes_no(pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES),
+ K(node_page_state(pgdat, NR_BALLOON_PAGES)));
}
for_each_populated_zone(zone) {
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 16bfe1c694dd..d3b11891a942 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1276,6 +1276,7 @@ const char * const vmstat_text[] = {
#ifdef CONFIG_HUGETLB_PAGE
"nr_hugetlb",
#endif
+ "nr_balloon_pages",
/* system-wide enum vm_stat_item counters */
"nr_dirty_threshold",
"nr_dirty_background_threshold",
--
2.48.1
next prev parent reply other threads:[~2025-03-12 0:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 0:06 [RFC 0/5] track memory used by balloon drivers Nico Pache
2025-03-12 0:06 ` Nico Pache [this message]
2025-03-12 4:20 ` [RFC 1/5] meminfo: add a per node counter for " Shakeel Butt
2025-03-12 20:14 ` Nico Pache
2025-03-12 22:19 ` David Hildenbrand
2025-03-12 23:04 ` Nico Pache
2025-03-13 8:22 ` David Hildenbrand
2025-03-13 17:35 ` Nico Pache
2025-03-13 22:33 ` David Hildenbrand
2025-03-13 7:20 ` Michael S. Tsirkin
2025-03-13 8:17 ` David Hildenbrand
2025-03-12 0:06 ` [RFC 2/5] virtio_balloon: update the NR_BALLOON_PAGES state Nico Pache
2025-03-12 6:55 ` Michael S. Tsirkin
2025-03-12 0:06 ` [RFC 3/5] hv_balloon: " Nico Pache
2025-03-12 0:06 ` [RFC 4/5] vmx_balloon: " Nico Pache
2025-03-12 6:56 ` Michael S. Tsirkin
2025-03-12 20:11 ` Nico Pache
2025-03-12 20:57 ` Michael S. Tsirkin
2025-03-12 22:17 ` David Hildenbrand
2025-03-12 0:07 ` [RFC 5/5] xen: balloon: " Nico Pache
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=20250312000700.184573-2-npache@redhat.com \
--to=npache@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.atanasov@virtuozzo.com \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cgroups@vger.kernel.org \
--cc=david@redhat.com \
--cc=decui@microsoft.com \
--cc=eperezma@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=hannes@cmpxchg.org \
--cc=jasowang@redhat.com \
--cc=jerrin.shaji-george@broadcom.com \
--cc=jgross@suse.com \
--cc=kanchana.p.sridhar@intel.com \
--cc=kys@microsoft.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mst@redhat.com \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=sstabellini@kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=wei.liu@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yosry.ahmed@linux.dev \
/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).