Hi Andrew

On 2026/5/9 02:31, Andrew Morton wrote:
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") 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.

...

--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -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;
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.

Please check my fixings:

--- 
a/drivers/base/node.c~mm-balloon-expose-per-node-balloon-pages-in-node-meminfo
+++ a/drivers/base/node.c
@@ -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;
_

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



Reply via email to