ia64/linux-2.6.18-xen.hg

view arch/mips/pci/fixup-emma2rh.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 * arch/mips/pci/fixup-emma2rh.c
3 * This file defines the PCI configration.
4 *
5 * Copyright (C) NEC Electronics Corporation 2004-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/pci.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
26 #include <linux/kernel.h>
27 #include <linux/init.h>
28 #include <linux/types.h>
29 #include <linux/pci.h>
31 #include <asm/bootinfo.h>
32 #include <asm/debug.h>
34 #include <asm/emma2rh/emma2rh.h>
36 #define EMMA2RH_PCI_HOST_SLOT 0x09
37 #define EMMA2RH_USB_SLOT 0x03
38 #define PCI_DEVICE_ID_NEC_EMMA2RH 0x014b /* EMMA2RH PCI Host */
40 /*
41 * we fix up irqs based on the slot number.
42 * The first entry is at AD:11.
43 * Fortunately this works because, although we have two pci buses,
44 * they all have different slot numbers (except for rockhopper slot 20
45 * which is handled below).
46 *
47 */
49 #define MAX_SLOT_NUM 10
50 static unsigned char irq_map[][5] __initdata = {
51 [3] = {0, MARKEINS_PCI_IRQ_INTB, MARKEINS_PCI_IRQ_INTC,
52 MARKEINS_PCI_IRQ_INTD, 0,},
53 [4] = {0, MARKEINS_PCI_IRQ_INTA, 0, 0, 0,},
54 [5] = {0, 0, 0, 0, 0,},
55 [6] = {0, MARKEINS_PCI_IRQ_INTC, MARKEINS_PCI_IRQ_INTD,
56 MARKEINS_PCI_IRQ_INTA, MARKEINS_PCI_IRQ_INTB,},
57 };
59 static void __devinit nec_usb_controller_fixup(struct pci_dev *dev)
60 {
61 if (PCI_SLOT(dev->devfn) == EMMA2RH_USB_SLOT)
62 /* on board USB controller configuration */
63 pci_write_config_dword(dev, 0xe4, 1 << 5);
64 }
66 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
67 nec_usb_controller_fixup);
69 /*
70 * Prevent the PCI layer from seeing the resources allocated to this device
71 * if it is the host bridge by marking it as such. These resources are of
72 * no consequence to the PCI layer (they are handled elsewhere).
73 */
74 static void __devinit emma2rh_pci_host_fixup(struct pci_dev *dev)
75 {
76 int i;
78 if (PCI_SLOT(dev->devfn) == EMMA2RH_PCI_HOST_SLOT) {
79 dev->class &= 0xff;
80 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
81 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
82 dev->resource[i].start = 0;
83 dev->resource[i].end = 0;
84 dev->resource[i].flags = 0;
85 }
86 }
87 }
89 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_EMMA2RH,
90 emma2rh_pci_host_fixup);
92 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
93 {
94 return irq_map[slot][pin];
95 }
97 /* Do platform specific device initialization at pci_enable_device() time */
98 int pcibios_plat_dev_init(struct pci_dev *dev)
99 {
100 return 0;
101 }