mm/balloon: expose per-node balloon pages in node meminfo
Subsystems (3)
PATCH v2 1/1 mm/balloon: expose per-node balloon pages in node meminfo
Commit 835de37603ef ("meminfo: add a per node counter for balloon drivers") added NR_BALLOON_PAGES and exposed it in /proc/meminfo. However, the per-node view at /sys/devices/system/node/nodeX/meminfo was not updated, even though the counter is already tracked per-node.
Add it to node_read_meminfo() so users can see balloon usage per NUMA node without having to parse the raw vmstat file.
---
v2: Move Balloon field after Unaccepted to match /proc/meminfo ordering
(suggested by David Hildenbrand)
--- drivers/base/node.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/node.c +3 -0
@@ -523,6 +523,7 @@ static ssize_t node_read_meminfo(struct device *dev,#ifdef CONFIG_UNACCEPTED_MEMORY "Node %d Unaccepted: %8lu kB\n" #endif +"Node %d Balloon: %8lu kB\n" , nid,K (node_page_state (pgdat,NR_FILE_DIRTY )), nid, K(node_page_state(pgdat, NR_WRITEBACK)),
@@ -556,6 +557,8 @@ static ssize_t node_read_meminfo(struct device *dev, , nid,K (sum_zone_node_page_state (nid,NR_UNACCEPTED )) #endif + , + nid,K (node_page_state (pgdat,NR_BALLOON_PAGES )) ); len +=hugetlb_report_node_meminfo (buf, len, nid);return len;
Signature · 1 line
2.25.1
Quoted 10 lines · Hao Ge
Commit
835de37603ef("meminfo: add a per node counter for balloon drivers") addedNR_BALLOON_PAGESand exposed it in/proc/meminfo. However, the per-node view at/sys/devices/system/node/nodeX/meminfowas not updated, even though the counter is already tracked per-node.Add it to
node_read_meminfo()so users can see balloon usage per NUMA node without having to parse the raw vmstat file.Signed-off-by Hao Ge <[email protected]>---
Patch subject should not start with "mm/balloon:".
"proc/meminfo: " might be the better choice. Likely can be changed when picking up
Signature · 3 lines
Cheers, David
Andrew Morton
maintainerQuoted 21 lines · On Fri, 8 May 2026 17:47:36 +0800 Hao Ge <[email protected]> wrote:
Commit
835de37603ef("meminfo: add a per node counter for balloon drivers") addedNR_BALLOON_PAGESand exposed it in/proc/meminfo. However, the per-node view at/sys/devices/system/node/nodeX/meminfowas not updated, even though the counter is already tracked per-node.Add it to
node_read_meminfo()so users can see balloon usage per NUMA node without having to parse the raw vmstat file....
drivers/base/node.c +1
-0@@ -523,6 +523,7 @@ static ssize_t node_read_meminfo(struct device *dev,#ifdef CONFIG_UNACCEPTED_MEMORY "Node %d Unaccepted: %8lu kB\n" #endif +"Node %d Balloon: %8lu kB\n" , nid,K (node_page_state (pgdat,NR_FILE_DIRTY )), nid, K(node_page_state(pgdat, NR_WRITEBACK)),
drivers/base/node.c static ssize_t node_read_meminfo(struct device *dev, · line 564
Quoted 8 lines
drivers/base/node.c +2
-0@@ -556,6 +557,8 @@ static ssize_t node_read_meminfo(struct device *dev, , nid,K (sum_zone_node_page_state (nid,NR_UNACCEPTED )) #endif + , + nid,K (node_page_state (pgdat,NR_BALLOON_PAGES )) ); len +=hugetlb_report_node_meminfo (buf, len, nid);return len;
This was prepared against a kernel whcih didn't have 2232ba9c7931 ("mm:
add gpu active/reclaim per-node stat counters (v2)"). Which was added in February, btw.
Please check my fixings:
drivers/base/node.c renamed from drivers/base/node.c~mm-balloon-expose-per-node-balloon-pages-in-node-meminfo +3 -1
@@ -525,6 +525,7 @@ static ssize_t node_read_meminfo(struct#endif "Node %d GPUActive: %8lu kB\n" "Node %d GPUReclaim: %8lu kB\n" +"Node %d Balloon: %8lu kB\n" , nid,K (node_page_state (pgdat,NR_FILE_DIRTY )), nid, K(node_page_state(pgdat, NR_WRITEBACK)),
@@ -560,7 +561,8 @@ static ssize_t node_read_meminfo(struct#endif , nid,K (node_page_state (pgdat,NR_GPU_ACTIVE )), - nid,K (node_page_state (pgdat,NR_GPU_RECLAIM )) + nid,K (node_page_state (pgdat,NR_GPU_RECLAIM )), + nid,K (node_page_state (pgdat,NR_BALLOON_PAGES )) ); len +=hugetlb_report_node_meminfo (buf, len, nid);return len;
_
Hi Andrew
Quoted 26 lines · Andrew Morton
Quoted 24 lines · On Fri, 8 May 2026 17:47:36 +0800 Hao Ge <[email protected]> wrote:
Commit
835de37603ef("meminfo: add a per node counter for balloon drivers") addedNR_BALLOON_PAGESand exposed it in/proc/meminfo. However, the per-node view at/sys/devices/system/node/nodeX/meminfowas not updated, even though the counter is already tracked per-node.Add it to
node_read_meminfo()so users can see balloon usage per NUMA node without having to parse the raw vmstat file....
drivers/base/node.c +1
-0@@ -523,6 +523,7 @@ static ssize_t node_read_meminfo(struct device *dev,#ifdef CONFIG_UNACCEPTED_MEMORY "Node %d Unaccepted: %8lu kB\n" #endif +"Node %d Balloon: %8lu kB\n" , nid,K (node_page_state (pgdat,NR_FILE_DIRTY )), nid, K(node_page_state(pgdat, NR_WRITEBACK)),@@ -556,6 +557,8 @@ static ssize_t node_read_meminfo(struct device *dev, , nid, K(sum_zone_node_page_state(nid, NR_UNACCEPTED))#endif
Quoted 8 lines
drivers/base/node.c static ssize_t node_read_meminfo(struct · line 568
Quoted 5 lines
drivers/base/node.c +2
-0+ , + nid,K (node_page_state (pgdat,NR_BALLOON_PAGES )) ); len +=hugetlb_report_node_meminfo (buf, len, nid);return len;This was prepared against a kernel whcih didn't have
2232ba9c7931("mm:
add gpu active/reclaim per-node stat counters (v2)"). Which was added in February, btw.
Sorry about that — I failed to git pull the latest code before preparing the v2 patch,
so I didn't realize commit 2232ba9c7931 ("mm: add gpu active/reclaim per-node stat counters (v2)")
had already been merged in February.
I apologize for the trouble this caused you.
Quoted 22 lines
Please check my fixings:
drivers/base/node.c renamed from drivers/base/node.c~mm-balloon-expose-per-node-balloon-pages-in-node-meminfo +3
-1@@ -525,6 +525,7 @@ static ssize_t node_read_meminfo(struct#endif "Node %d GPUActive: %8lu kB\n" "Node %d GPUReclaim: %8lu kB\n" +"Node %d Balloon: %8lu kB\n" , nid,K (node_page_state (pgdat,NR_FILE_DIRTY )), nid, K(node_page_state(pgdat, NR_WRITEBACK)),@@ -560,7 +561,8 @@ static ssize_t node_read_meminfo(struct#endif , nid,K (node_page_state (pgdat,NR_GPU_ACTIVE )), - nid,K (node_page_state (pgdat,NR_GPU_RECLAIM )) + nid,K (node_page_state (pgdat,NR_GPU_RECLAIM )), + nid,K (node_page_state (pgdat,NR_BALLOON_PAGES )) ); len +=hugetlb_report_node_meminfo (buf, len, nid);return len;
Quoted 1 line
_
As David suggested, the node meminfo fields should match the /proc/meminfo ordering.
So in the v3 I rebased on the latest tree and put Balloon between Unaccepted and GPUActive.
Here is the v3 patch: https://lore.kernel.org/all/[email protected]/
Sorry again for the inconvenience, Could you please replace the v2 patch in mm-new with this v3?
Thanks
Best Regards
Hao
Quoted 7 lines · On Fri, 8 May 2026 17:47:36 +0800 Hao Ge <[email protected]> wrote:
Commit
835de37603ef("meminfo: add a per node counter for balloon drivers") addedNR_BALLOON_PAGESand exposed it in/proc/meminfo. However, the per-node view at/sys/devices/system/node/nodeX/meminfowas not updated, even though the counter is already tracked per-node.Add it to
node_read_meminfo()so users can see balloon usage per NUMA node without having to parse the raw vmstat file.
Makes sense to me.
Quoted 2 lines
Signed-off-by Hao Ge <[email protected]>
Quoted 3 lines
---
v2: Move Balloon field after Unaccepted to match/proc/meminfoordering
(suggested by David Hildenbrand)
Adding a link to previous revision [1] would be nice.
[1] https://docs.kernel.org/process/submitting-patches.html#commentary
Thanks,
SJ
[...]