[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] balloon_alloc_empty_page_range() should set the reference count



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 369bdfa1e04aa5097440eb0cd548d4e2033365ae
# Parent  0ee104bd65570382ac408ccaa480192d9d047452
balloon_alloc_empty_page_range() should set the reference count
on every page structure before returning.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 0ee104bd6557 -r 369bdfa1e04a 
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c        Sun Apr 30 
09:26:01 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c        Sun Apr 30 
09:32:21 2006 +0100
@@ -540,6 +540,8 @@ struct page *balloon_alloc_empty_page_ra
        unsigned long vstart, flags;
        unsigned int  order = get_order(nr_pages * PAGE_SIZE);
        int ret;
+       unsigned long i;
+       struct page *page;
 
        vstart = __get_free_pages(GFP_KERNEL, order);
        if (vstart == 0)
@@ -559,7 +561,12 @@ struct page *balloon_alloc_empty_page_ra
 
        flush_tlb_all();
 
-       return virt_to_page(vstart);
+       page = virt_to_page(vstart);
+
+       for (i = 0; i < (1UL << order); i++)
+               set_page_count(page + i, 1);
+
+       return page;
 }
 
 void balloon_dealloc_empty_page_range(
@@ -569,8 +576,10 @@ void balloon_dealloc_empty_page_range(
        unsigned int  order = get_order(nr_pages * PAGE_SIZE);
 
        balloon_lock(flags);
-       for (i = 0; i < (1UL << order); i++)
+       for (i = 0; i < (1UL << order); i++) {
+               BUG_ON(page_count(page + i) != 1);
                balloon_append(page + i);
+       }
        balloon_unlock(flags);
 
        schedule_work(&balloon_worker);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.