mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm/balloon: fix NR_BALLOON_PAGES accounting on migration failure
@ 2026-11-14 16:47 shao.mingyin
  2026-11-14 17:31 ` Lorenzo Stoakes (ARM)
  0 siblings, 1 reply; 2+ messages in thread
From: shao.mingyin @ 2026-11-14 16:47 UTC (permalink / raw)
  To: akpm, david; +Cc: linux-mm, virtualization, linux-kernel

From: Shao Mingyin <shao.mingyin@zte.com.cn>

mm/balloon: fix NR_BALLOON_PAGES accounting on migration failure

A balloon driver's -ENOENT migration result means that the old page was
deflated but the replacement was not inflated. vmw_balloon returns this
when its deflate operation succeeds and the subsequent inflate fails.

balloon_page_migrate() accounts the deflation and frees the old page,
but does not decrement NR_BALLOON_PAGES. Each such failure therefore
leaves one extra page in the per-node count, which also contributes to
the Balloon value in /proc/meminfo.

Decrement the counter on the old page's node, matching normal dequeue
accounting.

Fixes: 4d689474e1b2 ("balloon_compaction: update the NR_BALLOON_PAGES state")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
Build-tested mm/balloon.o with W=1 and CONFIG_BALLOON_MIGRATION=y on
x86_64. The vmw_balloon -ENOENT callback path was reviewed statically.
No VMware hardware or hypervisor runtime test was performed.


 mm/balloon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/balloon.c b/mm/balloon.c
index 96a8f1e20bc66ae46a571a4f51243789bb362925..44c211ba8e6b0b86236ec0e05ca1eb4b9c444a8e 100644
--- a/mm/balloon.c
+++ b/mm/balloon.c
@@ -313,6 +313,7 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
 	} else {
 		/* Old page was deflated but new page not inflated. */
 		__count_vm_event(BALLOON_DEFLATE);
+		dec_node_page_state(page, NR_BALLOON_PAGES);
 
 		if (b_dev_info->adjust_managed_page_count)
 			adjust_managed_page_count(page, 1);

base-commit: 84abb955b1015477aa11a96e2f3ac1b938b77f48
-- 
2.43.0

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

end of thread, other threads:[~2026-11-14 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14 16:47 [PATCH] mm/balloon: fix NR_BALLOON_PAGES accounting on migration failure shao.mingyin
2026-11-14 17:31 ` Lorenzo Stoakes (ARM)

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

all inboxes | Powered by JetHome®