annotate arch/sparc/prom/devmap.c @ 897:329ea0ccb344

balloon: try harder to balloon up under memory pressure.

Currently if the balloon driver is unable to increase the guest's
reservation it assumes the failure was due to reaching its full
allocation, gives up on the ballooning operation and records the limit
it reached as the "hard limit". The driver will not try again until
the target is set again (even to the same value).

However it is possible that ballooning has in fact failed due to
memory pressure in the host and therefore it is desirable to keep
attempting to reach the target in case memory becomes available. The
most likely scenario is that some guests are ballooning down while
others are ballooning up and therefore there is temporary memory
pressure while things stabilise. You would not expect a well behaved
toolstack to ask a domain to balloon to more than its allocation nor
would you expect it to deliberately over-commit memory by setting
balloon targets which exceed the total host memory.

This patch drops the concept of a hard limit and causes the balloon
driver to retry increasing the reservation on a timer in the same
manner as when decreasing the reservation.

Also if we partially succeed in increasing the reservation
(i.e. receive less pages than we asked for) then we may as well keep
those pages rather than returning them to Xen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 14:01:20 2009 +0100 (2009-06-05)
parents 831230e53067
rev   line source
ian@0 1 /* $Id: devmap.c,v 1.7 2000/08/26 02:38:03 anton Exp $
ian@0 2 * promdevmap.c: Map device/IO areas to virtual addresses.
ian@0 3 *
ian@0 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
ian@0 5 */
ian@0 6
ian@0 7 #include <linux/types.h>
ian@0 8 #include <linux/kernel.h>
ian@0 9 #include <linux/sched.h>
ian@0 10
ian@0 11 #include <asm/openprom.h>
ian@0 12 #include <asm/oplib.h>
ian@0 13
ian@0 14 extern void restore_current(void);
ian@0 15
ian@0 16 /* Just like the routines in palloc.c, these should not be used
ian@0 17 * by the kernel at all. Bootloader facility mainly. And again,
ian@0 18 * this is only available on V2 proms and above.
ian@0 19 */
ian@0 20
ian@0 21 /* Map physical device address 'paddr' in IO space 'ios' of size
ian@0 22 * 'num_bytes' to a virtual address, with 'vhint' being a hint to
ian@0 23 * the prom as to where you would prefer the mapping. We return
ian@0 24 * where the prom actually mapped it.
ian@0 25 */
ian@0 26 char *
ian@0 27 prom_mapio(char *vhint, int ios, unsigned int paddr, unsigned int num_bytes)
ian@0 28 {
ian@0 29 unsigned long flags;
ian@0 30 char *ret;
ian@0 31
ian@0 32 spin_lock_irqsave(&prom_lock, flags);
ian@0 33 if((num_bytes == 0) || (paddr == 0)) ret = (char *) 0x0;
ian@0 34 else
ian@0 35 ret = (*(romvec->pv_v2devops.v2_dumb_mmap))(vhint, ios, paddr,
ian@0 36 num_bytes);
ian@0 37 restore_current();
ian@0 38 spin_unlock_irqrestore(&prom_lock, flags);
ian@0 39 return ret;
ian@0 40 }
ian@0 41
ian@0 42 /* Unmap an IO/device area that was mapped using the above routine. */
ian@0 43 void
ian@0 44 prom_unmapio(char *vaddr, unsigned int num_bytes)
ian@0 45 {
ian@0 46 unsigned long flags;
ian@0 47
ian@0 48 if(num_bytes == 0x0) return;
ian@0 49 spin_lock_irqsave(&prom_lock, flags);
ian@0 50 (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes);
ian@0 51 restore_current();
ian@0 52 spin_unlock_irqrestore(&prom_lock, flags);
ian@0 53 return;
ian@0 54 }