ia64/linux-2.6.18-xen.hg

view arch/alpha/kernel/console.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
line source
1 /*
2 * linux/arch/alpha/kernel/console.c
3 *
4 * Architecture-specific specific support for VGA device on
5 * non-0 I/O hose
6 */
8 #include <linux/pci.h>
9 #include <linux/init.h>
10 #include <linux/tty.h>
11 #include <linux/console.h>
12 #include <asm/vga.h>
13 #include <asm/machvec.h>
15 #ifdef CONFIG_VGA_HOSE
17 /*
18 * Externally-visible vga hose bases
19 */
20 unsigned long __vga_hose_io_base = 0; /* base for default hose */
21 unsigned long __vga_hose_mem_base = 0; /* base for default hose */
23 static struct pci_controller * __init
24 default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2)
25 {
26 if (h2->index < h1->index)
27 return h2;
29 return h1;
30 }
32 void __init
33 set_vga_hose(struct pci_controller *hose)
34 {
35 if (hose) {
36 __vga_hose_io_base = hose->io_space->start;
37 __vga_hose_mem_base = hose->mem_space->start;
38 }
39 }
41 void __init
42 locate_and_init_vga(void *(*sel_func)(void *, void *))
43 {
44 struct pci_controller *hose = NULL;
45 struct pci_dev *dev = NULL;
47 if (!sel_func) sel_func = (void *)default_vga_hose_select;
49 for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) {
50 if (!hose) hose = dev->sysdata;
51 else hose = sel_func(hose, dev->sysdata);
52 }
54 /* Did we already inititialize the correct one? */
55 if (conswitchp == &vga_con &&
56 __vga_hose_io_base == hose->io_space->start &&
57 __vga_hose_mem_base == hose->mem_space->start)
58 return;
60 /* Set the VGA hose and init the new console */
61 set_vga_hose(hose);
62 take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1);
63 }
65 #endif