[PATCH v2 4/4] xen: balloon: update the NR_BALLOON_PAGES state
From: Nico Pache
Date: Fri Mar 14 2025 - 17:39:35 EST
Update the NR_BALLOON_PAGES counter when pages are added to or
removed from the Xen balloon.
Signed-off-by: Nico Pache <npache@xxxxxxxxxx>
---
drivers/xen/balloon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 163f7f1d70f1..65d4e7fa1eb8 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -157,6 +157,8 @@ static void balloon_append(struct page *page)
list_add(&page->lru, &ballooned_pages);
balloon_stats.balloon_low++;
}
+ inc_node_page_state(page, NR_BALLOON_PAGES);
+
wake_up(&balloon_wq);
}
@@ -179,6 +181,8 @@ static struct page *balloon_retrieve(bool require_lowmem)
balloon_stats.balloon_low--;
__ClearPageOffline(page);
+ dec_node_page_state(page, NR_BALLOON_PAGES);
+
return page;
}
--
2.48.1