[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [BALLOON] Add fallback code so that e.g. a domain ballooned too far down can still
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID b4e32833439236e72b41d256277e48def038a80b # Parent ab63f44d948eb683edcc913205fb3bc126006cab [BALLOON] Add fallback code so that e.g. a domain ballooned too far down can still (slowly) recover. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c | 43 +++++++++++++-------- 1 files changed, 27 insertions(+), 16 deletions(-) diff -r ab63f44d948e -r b4e328334392 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Tue Jun 27 11:35:29 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Tue Jun 27 11:43:04 2006 +0100 @@ -172,7 +172,7 @@ static unsigned long current_target(void static int increase_reservation(unsigned long nr_pages) { - unsigned long *frame_list, pfn, i, flags; + unsigned long *frame_list, frame, pfn, i, flags; struct page *page; long rc; struct xen_memory_reservation reservation = { @@ -185,8 +185,11 @@ static int increase_reservation(unsigned nr_pages = PAGE_SIZE / sizeof(unsigned long); frame_list = (unsigned long *)__get_free_page(GFP_KERNEL); - if (frame_list == NULL) - return -ENOMEM; + if (frame_list == NULL) { + frame_list = &frame; + if (nr_pages > 1) + nr_pages = 1; + } balloon_lock(flags); @@ -202,14 +205,17 @@ static int increase_reservation(unsigned rc = HYPERVISOR_memory_op( XENMEM_populate_physmap, &reservation); if (rc < nr_pages) { - int ret; - /* We hit the Xen hard limit: reprobe. */ - set_xen_guest_handle(reservation.extent_start, frame_list); - reservation.nr_extents = rc; - ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, - &reservation); - BUG_ON(ret != rc); - hard_limit = current_pages + rc - driver_pages; + if (rc > 0) { + int ret; + + /* We hit the Xen hard limit: reprobe. */ + reservation.nr_extents = rc; + ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, + &reservation); + BUG_ON(ret != rc); + } + if (rc >= 0) + hard_limit = current_pages + rc - driver_pages; goto out; } @@ -247,14 +253,15 @@ static int increase_reservation(unsigned out: balloon_unlock(flags); - free_page((unsigned long)frame_list); + if (frame_list != &frame) + free_page((unsigned long)frame_list); return 0; } static int decrease_reservation(unsigned long nr_pages) { - unsigned long *frame_list, pfn, i, flags; + unsigned long *frame_list, frame, pfn, i, flags; struct page *page; void *v; int need_sleep = 0; @@ -269,8 +276,11 @@ static int decrease_reservation(unsigned nr_pages = PAGE_SIZE / sizeof(unsigned long); frame_list = (unsigned long *)__get_free_page(GFP_KERNEL); - if (frame_list == NULL) - return -ENOMEM; + if (frame_list == NULL) { + frame_list = &frame; + if (nr_pages > 1) + nr_pages = 1; + } for (i = 0; i < nr_pages; i++) { if ((page = alloc_page(GFP_HIGHUSER)) == NULL) { @@ -321,7 +331,8 @@ static int decrease_reservation(unsigned balloon_unlock(flags); - free_page((unsigned long)frame_list); + if (frame_list != &frame) + free_page((unsigned long)frame_list); return need_sleep; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |