From: Paolo Bonzini <pbonzini@redhat.com> Date: Fri, 6 Aug 2010 15:10:35 -0400 Subject: [virt] xen: remove dead code Message-id: <1281107435-18569-2-git-send-email-pbonzini@redhat.com> Patchwork-id: 27454 O-Subject: [RHEL5.5 PATCH 2/2] xen: remove dead code Bugzilla: 507846 RH-Acked-by: Jarod Wilson <jarod@redhat.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=507846 Upstream status: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/897 Brew build: https://brewweb.devel.redhat.com/taskinfo?taskID=2657991 This patch removes the now write-only hard_limit variable. The output in /proc is left compatible with the one of RHEL5, only the "hard limit" field will never be filled in. Upstream removed the field altogether. Together, this and the previous patch are a straight backport of c/s 897 except for this detail. I tested the two patches together using roughly the procedure in the bug report. A guest without the patch reported Current allocation: 3584780 kB Requested target: 4096000 kB Xen hard limit: 3584780 kB both before and after freeing memory. Instead, a guest with the patch showed no hard limit while the memory was not available: Current allocation: 2560352 kB Requested target: 3072000 kB Xen hard limit: ??? kB and successfully reserved 3000 MB after memory was freed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> diff --git a/drivers/xen/balloon/balloon.c b/drivers/xen/balloon/balloon.c index 720009a..62263e5 100644 --- a/drivers/xen/balloon/balloon.c +++ b/drivers/xen/balloon/balloon.c @@ -102,9 +102,6 @@ extern unsigned long totalhigh_pages; #define dec_totalhigh_pages() ((void)0) #endif -/* We may hit the hard limit in Xen. If we do then we remember it. */ -static unsigned long hard_limit; - /* * Drivers may alter the memory reservation independently, but they must * inform the balloon driver so that we can avoid hitting the hard limit. @@ -226,15 +223,10 @@ static int increase_reservation(unsigned long nr_pages) } set_xen_guest_handle(reservation.extent_start, frame_list); - reservation.nr_extents = nr_pages; - rc = HYPERVISOR_memory_op( - XENMEM_populate_physmap, &reservation); - if (rc < nr_pages) { - if (rc >= 0) - hard_limit = current_pages + rc - driver_pages; - else - goto out; - } + reservation.nr_extents = nr_pages; + rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation); + if (rc < 0) + goto out; for (i = 0; i < rc; i++) { page = balloon_retrieve(); @@ -384,7 +376,6 @@ static void balloon_process(void *unused) static void set_new_target(unsigned long target) { /* No need for lock. Not read-modify-write updates. */ - hard_limit = ~0UL; target_pages = target; schedule_work(&balloon_worker); } @@ -463,16 +454,11 @@ static int balloon_read(char *page, char **start, off_t off, "Low-mem balloon: %8lu kB\n" "High-mem balloon: %8lu kB\n" "Driver pages: %8lu kB\n" - "Xen hard limit: ", + "Xen hard limit: ??? kB\n", PAGES2KB(current_pages), PAGES2KB(target_pages), PAGES2KB(balloon_low), PAGES2KB(balloon_high), PAGES2KB(driver_pages)); - if (hard_limit != ~0UL) - len += sprintf(page + len, "%8lu kB\n", PAGES2KB(hard_limit)); - else - len += sprintf(page + len, " ??? kB\n"); - *eof = 1; return len; } @@ -502,7 +488,6 @@ static int __init balloon_init(void) balloon_low = 0; balloon_high = 0; driver_pages = 0UL; - hard_limit = ~0UL; init_timer(&balloon_timer); balloon_timer.data = 0;