Xen balloon: fix totalram_pages counting.

Change totalram_pages when a single page is added/removed to the
ballooned list. This avoid totalram_pages to be set erroneously to
max_pfn at boot.

Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stable Kernel <stable@kernel.org>

authored by

Gianluca Guida and committed by
Jeremy Fitzhardinge
3d65c948 b4606f21

+4 -3
+4 -3
drivers/xen/balloon.c
··· 136 136 list_add(&page->lru, &ballooned_pages); 137 137 balloon_stats.balloon_low++; 138 138 } 139 + 140 + totalram_pages--; 139 141 } 140 142 141 143 /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ ··· 157 155 } 158 156 else 159 157 balloon_stats.balloon_low--; 158 + 159 + totalram_pages++; 160 160 161 161 return page; 162 162 } ··· 264 260 } 265 261 266 262 balloon_stats.current_pages += nr_pages; 267 - totalram_pages = balloon_stats.current_pages; 268 263 269 264 out: 270 265 spin_unlock_irqrestore(&balloon_lock, flags); ··· 326 323 BUG_ON(ret != nr_pages); 327 324 328 325 balloon_stats.current_pages -= nr_pages; 329 - totalram_pages = balloon_stats.current_pages; 330 326 331 327 spin_unlock_irqrestore(&balloon_lock, flags); 332 328 ··· 424 422 pr_info("xen_balloon: Initialising balloon driver.\n"); 425 423 426 424 balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn); 427 - totalram_pages = balloon_stats.current_pages; 428 425 balloon_stats.target_pages = balloon_stats.current_pages; 429 426 balloon_stats.balloon_low = 0; 430 427 balloon_stats.balloon_high = 0;