diff mbox series

xen/balloon: fix ballooned page accounting without hotplug enabled

Message ID 20191212141750.1896-1-jgross@suse.com (mailing list archive)
State Accepted
Commit c673ec61ade89bf2f417960f986bc25671762efb
Headers show
Series xen/balloon: fix ballooned page accounting without hotplug enabled | expand

Commit Message

Jürgen Groß Dec. 12, 2019, 2:17 p.m. UTC
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.

Reported-by: Nicholas Tsirakis <niko.tsirakis@gmail.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 drivers/xen/balloon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Boris Ostrovsky Dec. 12, 2019, 6:30 p.m. UTC | #1
On 12/12/19 9:17 AM, Juergen Gross wrote:
> 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.
>
> Reported-by: Nicholas Tsirakis <niko.tsirakis@gmail.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
diff mbox series

Patch

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 4f2e78a5e4db..0c142bcab79d 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -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 */