Skip to content

Commit

Permalink
xen/balloon: Move dec_totalhigh_pages() from __balloon_append() to ba…
Browse files Browse the repository at this point in the history
…lloon_append()

git commit 9be4d45 (xen: add
extra pages to balloon) splited balloon_append() into two functions
(balloon_append() and __balloon_append()) and left decrementation
of totalram_pages counter in __balloon_append(). In this situation
if __balloon_append() is called on i386 with highmem page referenced
then totalhigh_pages is decremented, however, it should not. This
patch corrects that issue and moves dec_totalhigh_pages() from
__balloon_append() to balloon_append(). Now totalram_pages and
totalhigh_pages are decremented simultaneously only when
balloon_append() is called.

Acked-by: Ian Campbell <[email protected]>
Acked-by: Daniel De Graaf <[email protected]>
Signed-off-by: Daniel Kiper <[email protected]>
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
  • Loading branch information
dkiper authored and konradwilk committed Mar 30, 2011
1 parent 83be7e5 commit 09ca132
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ static void __balloon_append(struct page *page)
if (PageHighMem(page)) {
list_add_tail(&page->lru, &ballooned_pages);
balloon_stats.balloon_high++;
dec_totalhigh_pages();
} else {
list_add(&page->lru, &ballooned_pages);
balloon_stats.balloon_low++;
Expand All @@ -124,6 +123,8 @@ static void __balloon_append(struct page *page)
static void balloon_append(struct page *page)
{
__balloon_append(page);
if (PageHighMem(page))
dec_totalhigh_pages();
totalram_pages--;
}

Expand Down Expand Up @@ -462,7 +463,7 @@ static int __init balloon_init(void)
pfn < extra_pfn_end;
pfn++) {
page = pfn_to_page(pfn);
/* totalram_pages doesn't include the boot-time
/* totalram_pages and totalhigh_pages do not include the boot-time
balloon extension, so don't subtract from it. */
__balloon_append(page);
}
Expand Down

0 comments on commit 09ca132

Please sign in to comment.