.. to catch possible problems earlier. This is only a suggested patch,
not one strictly required.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Index: head-2007-02-27/drivers/xen/balloon/balloon.c
===================================================================
--- head-2007-02-27.orig/drivers/xen/balloon/balloon.c 2007-01-29
12:22:44.000000000 +0100
+++ head-2007-02-27/drivers/xen/balloon/balloon.c 2007-03-12
09:27:46.000000000 +0100
@@ -106,6 +106,8 @@ static struct timer_list balloon_timer;
/* balloon_append: add the given page to the balloon. */
static void balloon_append(struct page *page)
{
+ BUG_ON(!PageReserved(page));
+
/* Lowmem is re-populated first, so highmem pages go at list tail. */
if (PageHighMem(page)) {
list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
@@ -132,6 +134,8 @@ static struct page *balloon_retrieve(voi
else
bs.balloon_low--;
+ BUG_ON(!PageReserved(page));
+
return page;
}
@@ -293,6 +297,7 @@ static int decrease_reservation(unsigned
for (i = 0; i < nr_pages; i++) {
pfn = mfn_to_pfn(frame_list[i]);
set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
+ SetPageReserved(pfn_to_page(pfn));
balloon_append(pfn_to_page(pfn));
}
@@ -483,6 +488,7 @@ static int __init balloon_init(void)
for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) {
page = pfn_to_page(pfn);
if (!PageReserved(page))
+ SetPageReserved(page),
balloon_append(page);
}
#endif
@@ -560,6 +566,8 @@ struct page **alloc_empty_pages_and_page
} else {
ret = apply_to_page_range(&init_mm, vaddr, PAGE_SIZE,
dealloc_pte_fn, NULL);
+ if (ret == 0)
+ SetPageReserved(page);
}
if (ret != 0) {
@@ -599,6 +607,7 @@ static void free_empty_pages_and_pageve
balloon_lock(flags);
for (i = 0; i < nr_pages; i++) {
BUG_ON(page_count(pagevec[i]) != 1);
+ set_phys_to_machine(page_to_pfn(pagevec[i]), INVALID_P2M_ENTRY);
balloon_append(pagevec[i]);
}
balloon_unlock(flags);
@@ -613,6 +622,7 @@ void balloon_release_driver_page(struct
unsigned long flags;
balloon_lock(flags);
+ set_phys_to_machine(page_to_pfn(page), INVALID_P2M_ENTRY);
balloon_append(page);
bs.driver_pages--;
balloon_unlock(flags);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|