Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo
@ 2026-05-08  9:47 Hao Ge
  2026-05-08 10:57 ` David Hildenbrand (Arm)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hao Ge @ 2026-05-08  9:47 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand
  Cc: linux-mm, virtualization, linux-kernel, Hao Ge

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.

Signed-off-by: Hao Ge <hao.ge@linux.dev>
---
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(+)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index d7647d077b66..85c20aa3c7f2 100644
--- 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;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo
  2026-05-08  9:47 [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo Hao Ge
@ 2026-05-08 10:57 ` David Hildenbrand (Arm)
  2026-05-08 18:31 ` Andrew Morton
  2026-05-09  1:07 ` SeongJae Park
  2 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-05-08 10:57 UTC (permalink / raw)
  To: Hao Ge, Andrew Morton; +Cc: linux-mm, virtualization, linux-kernel

On 5/8/26 11:47, Hao Ge 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.
> 
> Signed-off-by: Hao Ge <hao.ge@linux.dev>
> ---

Patch subject should not start with "mm/balloon:".

"proc/meminfo: " might be the better choice. Likely can be changed when picking up

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo
  2026-05-08  9:47 [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo Hao Ge
  2026-05-08 10:57 ` David Hildenbrand (Arm)
@ 2026-05-08 18:31 ` Andrew Morton
  2026-05-09  1:14   ` Hao Ge
  2026-05-09  1:07 ` SeongJae Park
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2026-05-08 18:31 UTC (permalink / raw)
  To: Hao Ge; +Cc: David Hildenbrand, linux-mm, virtualization, linux-kernel

On Fri,  8 May 2026 17:47:36 +0800 Hao Ge <hao.ge@linux.dev> 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.

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;
_



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo
  2026-05-08  9:47 [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo Hao Ge
  2026-05-08 10:57 ` David Hildenbrand (Arm)
  2026-05-08 18:31 ` Andrew Morton
@ 2026-05-09  1:07 ` SeongJae Park
  2 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2026-05-09  1:07 UTC (permalink / raw)
  To: Hao Ge
  Cc: SeongJae Park, Andrew Morton, David Hildenbrand, linux-mm,
	virtualization, linux-kernel

On Fri,  8 May 2026 17:47:36 +0800 Hao Ge <hao.ge@linux.dev> 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.

Makes sense to me.

> 
> Signed-off-by: Hao Ge <hao.ge@linux.dev>

Acked-by: SeongJae Park <sj@kernel.org>

> ---
> v2: Move Balloon field after Unaccepted to match /proc/meminfo ordering
>     (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

[...]


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo
  2026-05-08 18:31 ` Andrew Morton
@ 2026-05-09  1:14   ` Hao Ge
  0 siblings, 0 replies; 5+ messages in thread
From: Hao Ge @ 2026-05-09  1:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Hildenbrand, linux-mm, virtualization, linux-kernel

Hi Andrew


On 2026/5/9 02:31, Andrew Morton wrote:
> On Fri,  8 May 2026 17:47:36 +0800 Hao Ge <hao.ge@linux.dev> 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/20260509005631.17183-1-hao.ge@linux.dev/

  Sorry again for the inconvenience, Could you please replace the v2 
patch in mm-new with this v3?

Thanks

Best Regards

Hao




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-09  1:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08  9:47 [PATCH v2] mm/balloon: expose per-node balloon pages in node meminfo Hao Ge
2026-05-08 10:57 ` David Hildenbrand (Arm)
2026-05-08 18:31 ` Andrew Morton
2026-05-09  1:14   ` Hao Ge
2026-05-09  1:07 ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox