Skip to contentSkip to conversation

xen/balloon: fix ballooned page accounting without hotplug enabled

PATCH In review Juergen Gross 2 participants 2 messages Dec 12, 2019 Xen hypervisor interface

lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH 1/1 xen/balloon: fix ballooned page accounting without hotplug enabled

When CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not defined reserve_additional_memory() will set balloon_stats.target_pages to a wrong value in case there are still some ballooned pages allocated via alloc_xenballooned_pages().

This will result in balloon_process() no longer be triggered when ballooned pages are freed in batches.

---
 drivers/xen/balloon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/balloon.c +2 -1
index 4f2e78a5e4db..0c142bcab79d 100644
@@ -394,7 +394,8 @@ static struct notifier_block xen_memory_nb = {
 #else
 static enum bp_state reserve_additional_memory(void)
 {
-	balloon_stats.target_pages = balloon_stats.current_pages;
+	balloon_stats.target_pages = balloon_stats.current_pages +
+				     balloon_stats.target_unpopulated;
 	return BP_ECANCELED;
 }
 #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */
Signature · 1 line
2.16.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Juergen Gross

When CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not defined reserve_additional_memory() will set balloon_stats.target_pages to a wrong value in case there are still some ballooned pages allocated via alloc_xenballooned_pages().

This will result in balloon_process() no longer be triggered when ballooned pages are freed in batches.