ia64/linux-2.6.18-xen.hg

view arch/mips/pci/fixup-sni.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 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SNI specific PCI support for RM200/RM300.
7 *
8 * Copyright (C) 1997 - 2000, 2003, 04 Ralf Baechle (ralf@linux-mips.org)
9 */
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/pci.h>
14 #include <asm/mipsregs.h>
15 #include <asm/sni.h>
17 /*
18 * Shortcuts ...
19 */
20 #define SCSI PCIMT_IRQ_SCSI
21 #define ETH PCIMT_IRQ_ETHERNET
22 #define INTA PCIMT_IRQ_INTA
23 #define INTB PCIMT_IRQ_INTB
24 #define INTC PCIMT_IRQ_INTC
25 #define INTD PCIMT_IRQ_INTD
27 /*
28 * Device 0: PCI EISA Bridge (directly routed)
29 * Device 1: NCR53c810 SCSI (directly routed)
30 * Device 2: PCnet32 Ethernet (directly routed)
31 * Device 3: VGA (routed to INTB)
32 * Device 4: Unused
33 * Device 5: Slot 2
34 * Device 6: Slot 3
35 * Device 7: Slot 4
36 *
37 * Documentation says the VGA is device 5 and device 3 is unused but that
38 * seem to be a documentation error. At least on my RM200C the Cirrus
39 * Logic CL-GD5434 VGA is device 3.
40 */
41 static char irq_tab_rm200[8][5] __initdata = {
42 /* INTA INTB INTC INTD */
43 { 0, 0, 0, 0, 0 }, /* EISA bridge */
44 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
45 { ETH, ETH, ETH, ETH, ETH }, /* Ethernet */
46 { INTB, INTB, INTB, INTB, INTB }, /* VGA */
47 { 0, 0, 0, 0, 0 }, /* Unused */
48 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
49 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
50 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
51 };
53 /*
54 * In Revision D of the RM300 Device 2 has become a normal purpose Slot 1
55 *
56 * The VGA card is optional for RM300 systems.
57 */
58 static char irq_tab_rm300d[8][5] __initdata = {
59 /* INTA INTB INTC INTD */
60 { 0, 0, 0, 0, 0 }, /* EISA bridge */
61 { SCSI, SCSI, SCSI, SCSI, SCSI }, /* SCSI */
62 { 0, INTC, INTD, INTA, INTB }, /* Slot 1 */
63 { INTB, INTB, INTB, INTB, INTB }, /* VGA */
64 { 0, 0, 0, 0, 0 }, /* Unused */
65 { 0, INTB, INTC, INTD, INTA }, /* Slot 2 */
66 { 0, INTC, INTD, INTA, INTB }, /* Slot 3 */
67 { 0, INTD, INTA, INTB, INTC }, /* Slot 4 */
68 };
70 static inline int is_rm300_revd(void)
71 {
72 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
74 return (csmsr & 0xa0) == 0x20;
75 }
77 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
78 {
79 if (is_rm300_revd())
80 return irq_tab_rm300d[slot][pin];
82 return irq_tab_rm200[slot][pin];
83 }
85 /* Do platform specific device initialization at pci_enable_device() time */
86 int pcibios_plat_dev_init(struct pci_dev *dev)
87 {
88 return 0;
89 }