diff options
author | Gianluca Guida <gianluca.guida@citrix.com> | 2009-07-31 01:54:36 +0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-12-04 19:13:44 +0300 |
commit | 3d65c9488cadd2f11bd4d60c7266e639ece5d0d6 (patch) | |
tree | 94790d79e492f8fee50b8d9e6a5a7043b1941eff /drivers/xen/balloon.c | |
parent | b4606f2165153833247823e8c04c5e88cb3d298b (diff) | |
download | linux-3d65c9488cadd2f11bd4d60c7266e639ece5d0d6.tar.xz |
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>
Diffstat (limited to 'drivers/xen/balloon.c')
-rw-r--r-- | drivers/xen/balloon.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index d31505b6f7a4..6eb62654410a 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -136,6 +136,8 @@ static void balloon_append(struct page *page) list_add(&page->lru, &ballooned_pages); balloon_stats.balloon_low++; } + + totalram_pages--; } /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ @@ -156,6 +158,8 @@ static struct page *balloon_retrieve(void) else balloon_stats.balloon_low--; + totalram_pages++; + return page; } @@ -260,7 +264,6 @@ static int increase_reservation(unsigned long nr_pages) } balloon_stats.current_pages += nr_pages; - totalram_pages = balloon_stats.current_pages; out: spin_unlock_irqrestore(&balloon_lock, flags); @@ -323,7 +326,6 @@ static int decrease_reservation(unsigned long nr_pages) BUG_ON(ret != nr_pages); balloon_stats.current_pages -= nr_pages; - totalram_pages = balloon_stats.current_pages; spin_unlock_irqrestore(&balloon_lock, flags); @@ -422,7 +424,6 @@ static int __init balloon_init(void) pr_info("xen_balloon: Initialising balloon driver.\n"); balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn); - totalram_pages = balloon_stats.current_pages; balloon_stats.target_pages = balloon_stats.current_pages; balloon_stats.balloon_low = 0; balloon_stats.balloon_high = 0; |