aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/xen/balloon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 77b5dc3597e3..2b17ad5b4b32 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -50,6 +50,7 @@
50#include <asm/pgtable.h> 50#include <asm/pgtable.h>
51#include <asm/uaccess.h> 51#include <asm/uaccess.h>
52#include <asm/tlb.h> 52#include <asm/tlb.h>
53#include <asm/e820.h>
53 54
54#include <asm/xen/hypervisor.h> 55#include <asm/xen/hypervisor.h>
55#include <asm/xen/hypercall.h> 56#include <asm/xen/hypercall.h>
@@ -391,7 +392,7 @@ static struct notifier_block xenstore_notifier;
391 392
392static int __init balloon_init(void) 393static int __init balloon_init(void)
393{ 394{
394 unsigned long pfn; 395 unsigned long pfn, extra_pfn_end;
395 struct page *page; 396 struct page *page;
396 397
397 if (!xen_pv_domain()) 398 if (!xen_pv_domain())
@@ -412,8 +413,10 @@ static int __init balloon_init(void)
412 register_balloon(&balloon_sysdev); 413 register_balloon(&balloon_sysdev);
413 414
414 /* Initialise the balloon with excess memory space. */ 415 /* Initialise the balloon with excess memory space. */
416 extra_pfn_end = min(e820_end_of_ram_pfn(),
417 (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size));
415 for (pfn = PFN_UP(xen_extra_mem_start); 418 for (pfn = PFN_UP(xen_extra_mem_start);
416 pfn < PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size); 419 pfn < extra_pfn_end;
417 pfn++) { 420 pfn++) {
418 page = pfn_to_page(pfn); 421 page = pfn_to_page(pfn);
419 /* totalram_pages doesn't include the boot-time 422 /* totalram_pages doesn't include the boot-time