[precise][PATCH 2/2](upstream) xen/balloon: Set balloon's initial state to number of existing RAM pages

Dan Streetman dan.streetman at canonical.com
Sat Sep 17 10:33:39 UTC 2016

From: Boris Ostrovsky <boris.ostrovsky at oracle.com>

BugLink: http://bugs.launchpad.net/bugs/1622567

Currently balloon's initial value is set to max_pfn which includes
non-RAM ranges such as MMIO hole. As result, initial memory target
(specified by guest's configuration file) will appear smaller than
what balloon driver perceives to be the current number of available
pages. Thus it will balloon down "extra" pages, decreasing amount of
available memory for no good reason.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky at oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
(cherry-picked from commit c275a57f5ec3056f732843b11659d892235faff7 upstream)
Signed-off-by: Dan Streetman <dan.streetman at canonical.com>
 drivers/xen/balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 31ab82f..7e40228 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -592,7 +592,7 @@ static int __init balloon_init(void)
 	balloon_stats.current_pages = xen_pv_domain()
 		? min(xen_start_info->nr_pages - xen_released_pages, max_pfn)
-		: max_pfn;
+		: get_num_physpages();
 	balloon_stats.target_pages  = balloon_stats.current_pages;
 	balloon_stats.balloon_low   = 0;
 	balloon_stats.balloon_high  = 0;

More information about the kernel-team mailing list