]> Pileus Git - ~andy/linux/blobdiff - drivers/xen/balloon.c
Merge branch 'akpm' (updates from Andrew Morton)
[~andy/linux] / drivers / xen / balloon.c
index e33615335aa0e96acbb468d0754b76138201110c..2a2ef97697b266af2b36428c35584b85955c04ef 100644 (file)
@@ -91,14 +91,6 @@ EXPORT_SYMBOL_GPL(balloon_stats);
 /* We increase/decrease in batches which fit in a page */
 static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)];
 
-#ifdef CONFIG_HIGHMEM
-#define inc_totalhigh_pages() (totalhigh_pages++)
-#define dec_totalhigh_pages() (totalhigh_pages--)
-#else
-#define inc_totalhigh_pages() do {} while (0)
-#define dec_totalhigh_pages() do {} while (0)
-#endif
-
 /* List of ballooned pages, threaded through the mem_map array. */
 static LIST_HEAD(ballooned_pages);
 
@@ -134,9 +126,7 @@ 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--;
+       adjust_managed_page_count(page, -1);
 }
 
 /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
@@ -153,13 +143,12 @@ static struct page *balloon_retrieve(bool prefer_highmem)
                page = list_entry(ballooned_pages.next, struct page, lru);
        list_del(&page->lru);
 
-       if (PageHighMem(page)) {
+       if (PageHighMem(page))
                balloon_stats.balloon_high--;
-               inc_totalhigh_pages();
-       } else
+       else
                balloon_stats.balloon_low--;
 
-       totalram_pages++;
+       adjust_managed_page_count(page, 1);
 
        return page;
 }
@@ -374,9 +363,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
 #endif
 
                /* Relinquish the page back to the allocator. */
-               ClearPageReserved(page);
-               init_page_count(page);
-               __free_page(page);
+               __free_reserved_page(page);
        }
 
        balloon_stats.current_pages += rc;