The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] mm/balloon: expose per-node balloon pages in node meminfo
@ 2026-05-08  1:53 Hao Ge
  2026-05-08  8:23 ` David Hildenbrand (Arm)
  0 siblings, 1 reply; 3+ messages in thread
From: Hao Ge @ 2026-05-08  1:53 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>
---
 drivers/base/node.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index d7647d077b66..53f4e51d6d82 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -513,6 +513,7 @@ static ssize_t node_read_meminfo(struct device *dev,
 			     "Node %d Slab:           %8lu kB\n"
 			     "Node %d SReclaimable:   %8lu kB\n"
 			     "Node %d SUnreclaim:     %8lu kB\n"
+			     "Node %d Balloon:        %8lu kB\n"
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			     "Node %d AnonHugePages:  %8lu kB\n"
 			     "Node %d ShmemHugePages: %8lu kB\n"
@@ -543,7 +544,8 @@ static ssize_t node_read_meminfo(struct device *dev,
 				    node_page_state(pgdat, NR_KERNEL_MISC_RECLAIMABLE)),
 			     nid, K(sreclaimable + sunreclaimable),
 			     nid, K(sreclaimable),
-			     nid, K(sunreclaimable)
+			     nid, K(sunreclaimable),
+			     nid, K(node_page_state(pgdat, NR_BALLOON_PAGES))
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 			     ,
 			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
-- 
2.25.1


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

* Re: [PATCH] mm/balloon: expose per-node balloon pages in node meminfo
  2026-05-08  1:53 [PATCH] mm/balloon: expose per-node balloon pages in node meminfo Hao Ge
@ 2026-05-08  8:23 ` David Hildenbrand (Arm)
  2026-05-08  9:59   ` Hao Ge
  0 siblings, 1 reply; 3+ messages in thread
From: David Hildenbrand (Arm) @ 2026-05-08  8:23 UTC (permalink / raw)
  To: Hao Ge, Andrew Morton; +Cc: linux-mm, virtualization, linux-kernel

On 5/8/26 03:53, 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.

Using ballooning with vNUMA is rather rare. But sure, why not.

> 
> Signed-off-by: Hao Ge <hao.ge@linux.dev>
> ---
>  drivers/base/node.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index d7647d077b66..53f4e51d6d82 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -513,6 +513,7 @@ static ssize_t node_read_meminfo(struct device *dev,
>  			     "Node %d Slab:           %8lu kB\n"
>  			     "Node %d SReclaimable:   %8lu kB\n"
>  			     "Node %d SUnreclaim:     %8lu kB\n"
> +			     "Node %d Balloon:        %8lu kB\n"
>  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>  			     "Node %d AnonHugePages:  %8lu kB\n"
>  			     "Node %d ShmemHugePages: %8lu kB\n"
> @@ -543,7 +544,8 @@ static ssize_t node_read_meminfo(struct device *dev,
>  				    node_page_state(pgdat, NR_KERNEL_MISC_RECLAIMABLE)),
>  			     nid, K(sreclaimable + sunreclaimable),
>  			     nid, K(sreclaimable),
> -			     nid, K(sunreclaimable)
> +			     nid, K(sunreclaimable),
> +			     nid, K(node_page_state(pgdat, NR_BALLOON_PAGES))
>  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>  			     ,
>  			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),


Shouldn't it be placed under "Unaccepted:", just like for /proc/meminfo?

-- 
Cheers,

David

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

* Re: [PATCH] mm/balloon: expose per-node balloon pages in node meminfo
  2026-05-08  8:23 ` David Hildenbrand (Arm)
@ 2026-05-08  9:59   ` Hao Ge
  0 siblings, 0 replies; 3+ messages in thread
From: Hao Ge @ 2026-05-08  9:59 UTC (permalink / raw)
  To: David Hildenbrand (Arm), Andrew Morton
  Cc: linux-mm, virtualization, linux-kernel

Hi David


On 2026/5/8 16:23, David Hildenbrand (Arm) wrote:
> On 5/8/26 03:53, 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.
> Using ballooning with vNUMA is rather rare. But sure, why not.

Yeah, it's indeed not common.

We came across this while analyzing a customer's 16C 32G VM with 2 vNUMA 
nodes and balloon enabled.


>> Signed-off-by: Hao Ge <hao.ge@linux.dev>
>> ---
>>   drivers/base/node.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/node.c b/drivers/base/node.c
>> index d7647d077b66..53f4e51d6d82 100644
>> --- a/drivers/base/node.c
>> +++ b/drivers/base/node.c
>> @@ -513,6 +513,7 @@ static ssize_t node_read_meminfo(struct device *dev,
>>   			     "Node %d Slab:           %8lu kB\n"
>>   			     "Node %d SReclaimable:   %8lu kB\n"
>>   			     "Node %d SUnreclaim:     %8lu kB\n"
>> +			     "Node %d Balloon:        %8lu kB\n"
>>   #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>>   			     "Node %d AnonHugePages:  %8lu kB\n"
>>   			     "Node %d ShmemHugePages: %8lu kB\n"
>> @@ -543,7 +544,8 @@ static ssize_t node_read_meminfo(struct device *dev,
>>   				    node_page_state(pgdat, NR_KERNEL_MISC_RECLAIMABLE)),
>>   			     nid, K(sreclaimable + sunreclaimable),
>>   			     nid, K(sreclaimable),
>> -			     nid, K(sunreclaimable)
>> +			     nid, K(sunreclaimable),
>> +			     nid, K(node_page_state(pgdat, NR_BALLOON_PAGES))
>>   #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>>   			     ,
>>   			     nid, K(node_page_state(pgdat, NR_ANON_THPS)),
>
> Shouldn't it be placed under "Unaccepted:", just like for /proc/meminfo?
>
Good catch, thanks. I overlooked this detail -- will fix in v2.

Thanks

Best Regards

Hao


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

end of thread, other threads:[~2026-05-08 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08  1:53 [PATCH] mm/balloon: expose per-node balloon pages in node meminfo Hao Ge
2026-05-08  8:23 ` David Hildenbrand (Arm)
2026-05-08  9:59   ` Hao Ge

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