ia64/linux-2.6.18-xen.hg

annotate arch/sparc/prom/init.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
children
rev   line source
ian@0 1 /* $Id: init.c,v 1.14 2000/01/29 01:09:12 anton Exp $
ian@0 2 * init.c: Initialize internal variables used by the PROM
ian@0 3 * library functions.
ian@0 4 *
ian@0 5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
ian@0 6 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
ian@0 7 */
ian@0 8
ian@0 9 #include <linux/kernel.h>
ian@0 10 #include <linux/init.h>
ian@0 11
ian@0 12 #include <asm/openprom.h>
ian@0 13 #include <asm/oplib.h>
ian@0 14 #include <asm/sun4prom.h>
ian@0 15
ian@0 16 struct linux_romvec *romvec;
ian@0 17 enum prom_major_version prom_vers;
ian@0 18 unsigned int prom_rev, prom_prev;
ian@0 19 linux_sun4_romvec *sun4_romvec;
ian@0 20
ian@0 21 /* The root node of the prom device tree. */
ian@0 22 int prom_root_node;
ian@0 23
ian@0 24 int prom_stdin, prom_stdout;
ian@0 25
ian@0 26 /* Pointer to the device tree operations structure. */
ian@0 27 struct linux_nodeops *prom_nodeops;
ian@0 28
ian@0 29 /* You must call prom_init() before you attempt to use any of the
ian@0 30 * routines in the prom library. It returns 0 on success, 1 on
ian@0 31 * failure. It gets passed the pointer to the PROM vector.
ian@0 32 */
ian@0 33
ian@0 34 extern void prom_meminit(void);
ian@0 35 extern void prom_ranges_init(void);
ian@0 36
ian@0 37 void __init prom_init(struct linux_romvec *rp)
ian@0 38 {
ian@0 39 #ifdef CONFIG_SUN4
ian@0 40 extern struct linux_romvec *sun4_prom_init(void);
ian@0 41 rp = sun4_prom_init();
ian@0 42 #endif
ian@0 43 romvec = rp;
ian@0 44
ian@0 45 switch(romvec->pv_romvers) {
ian@0 46 case 0:
ian@0 47 prom_vers = PROM_V0;
ian@0 48 break;
ian@0 49 case 2:
ian@0 50 prom_vers = PROM_V2;
ian@0 51 break;
ian@0 52 case 3:
ian@0 53 prom_vers = PROM_V3;
ian@0 54 break;
ian@0 55 case 40:
ian@0 56 prom_vers = PROM_SUN4;
ian@0 57 break;
ian@0 58 default:
ian@0 59 prom_printf("PROMLIB: Bad PROM version %d\n",
ian@0 60 romvec->pv_romvers);
ian@0 61 prom_halt();
ian@0 62 break;
ian@0 63 };
ian@0 64
ian@0 65 prom_rev = romvec->pv_plugin_revision;
ian@0 66 prom_prev = romvec->pv_printrev;
ian@0 67 prom_nodeops = romvec->pv_nodeops;
ian@0 68
ian@0 69 prom_root_node = prom_getsibling(0);
ian@0 70 if((prom_root_node == 0) || (prom_root_node == -1))
ian@0 71 prom_halt();
ian@0 72
ian@0 73 if((((unsigned long) prom_nodeops) == 0) ||
ian@0 74 (((unsigned long) prom_nodeops) == -1))
ian@0 75 prom_halt();
ian@0 76
ian@0 77 if(prom_vers == PROM_V2 || prom_vers == PROM_V3) {
ian@0 78 prom_stdout = *romvec->pv_v2bootargs.fd_stdout;
ian@0 79 prom_stdin = *romvec->pv_v2bootargs.fd_stdin;
ian@0 80 }
ian@0 81
ian@0 82 prom_meminit();
ian@0 83
ian@0 84 prom_ranges_init();
ian@0 85
ian@0 86 #ifndef CONFIG_SUN4
ian@0 87 /* SUN4 prints this in sun4_prom_init */
ian@0 88 printk("PROMLIB: Sun Boot Prom Version %d Revision %d\n",
ian@0 89 romvec->pv_romvers, prom_rev);
ian@0 90 #endif
ian@0 91
ian@0 92 /* Initialization successful. */
ian@0 93 return;
ian@0 94 }