Oracle bug 8300888 The balloon code needs to adjust totalhigh_pages 5/8/2009 Chuck Anderson The balloon code needs to adjust the global kernel symbol totalhigh_pages when it adds/removes pages from/to high memory. Otherwise, totalhigh_pages will not represent the number of pages in high memory. --- linux-2.6.9/mm/page_alloc.c.orig 2009-03-10 14:30:29.000000000 -0700 +++ linux-2.6.9/mm/page_alloc.c 2009-03-10 14:32:47.000000000 -0700 @@ -44,6 +44,7 @@ int sysctl_lower_zone_protection = 0; EXPORT_SYMBOL(totalram_pages); +EXPORT_SYMBOL(totalhigh_pages); EXPORT_SYMBOL(nr_swap_pages); /* --- linux-2.6.9/drivers/xen/balloon/balloon.c.orig 2009-03-10 14:33:36.000000000 -0700 +++ linux-2.6.9/drivers/xen/balloon/balloon.c 2009-03-10 14:38:37.000000000 -0700 @@ -92,6 +92,7 @@ /* VM /proc information for memory */ extern unsigned long totalram_pages; +extern unsigned long totalhigh_pages; /* We may hit the hard limit in Xen. If we do then we remember it. */ static unsigned long hard_limit; @@ -137,6 +138,7 @@ if (PageHighMem(page)) { list_add_tail(PAGE_TO_LIST(page), &ballooned_pages); balloon_high++; + totalhigh_pages--; } else { list_add(PAGE_TO_LIST(page), &ballooned_pages); balloon_low++; @@ -154,10 +156,13 @@ page = LIST_TO_PAGE(ballooned_pages.next); UNLIST_PAGE(page); - if (PageHighMem(page)) + if (PageHighMem(page)) { balloon_high--; - else + totalhigh_pages++; + } + else { balloon_low--; + } return page; } @@ -609,6 +614,9 @@ } totalram_pages = --current_pages; + if (PageHighMem(page)) { + totalhigh_pages--; + } balloon_unlock(flags); }