[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] linux/balloon: Fix hugepage-related bugs
Fix a couple of bugs in the hugepage changes to the Xen balloon driver. Signed-off-by: Dave McCracken <dave.mccracken@xxxxxxxxxx> -------- balloon.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) --- 2.6-xen/drivers/xen/balloon.c 2009-12-17 14:20:57.000000000 -0600 +++ 2.6-xen-balloon//drivers/xen/balloon.c 2009-12-18 15:26:12.000000000 -0600 @@ -283,7 +283,7 @@ static int increase_reservation(unsigned /* Relinquish the page back to the allocator. */ ClearPageReserved(page); init_page_count(page); - __free_page(page); + __free_pages(page, balloon_order); } balloon_stats.current_pages += rc; @@ -531,12 +531,13 @@ struct page **alloc_empty_pages_and_page /* Round up to next number of balloon_order pages */ npages = (nr_pages + (balloon_npages-1)) >> balloon_order; - pagevec = kmalloc(sizeof(page) * nr_pages << balloon_order, GFP_KERNEL); + pagevec = kmalloc(sizeof(page) * nr_pages, GFP_KERNEL); if (pagevec == NULL) return NULL; - for (i = 0; i < nr_pages; i++) { + for (i = 0; i < npages; i++) { void *v; + int limit; page = alloc_pages(GFP_KERNEL|__GFP_COLD, balloon_order); if (page == NULL) @@ -555,10 +556,14 @@ struct page **alloc_empty_pages_and_page if (ret != 0) { mutex_unlock(&balloon_mutex); //balloon_free_page(page); /* tries to use free_cold_page */ - __free_page(page); + __free_pages(page, balloon_order); goto err; } - for (j = 0; j < balloon_npages; j++) + if (i == (npages-1)) + limit = nr_pages - (i << balloon_order); + else + limit = balloon_npages; + for (j = 0; j < limit; j++) pagevec[(i<<balloon_order)+j] = page++; totalram_pages = balloon_stats.current_pages -= balloon_npages; @@ -595,7 +600,7 @@ void free_empty_pages_and_pagevec(struct npages = (nr_pages + (balloon_npages-1)) >> balloon_order; mutex_lock(&balloon_mutex); - for (i = 0; i < nr_pages; i++) { + for (i = 0; i < npages; i++) { page = pagevec[i << balloon_order]; BUG_ON(page_count(page) != 1); balloon_append(page); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |