ia64/linux-2.6.18-xen.hg

view drivers/mtd/maps/arctic-mtd.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 * $Id: arctic-mtd.c,v 1.14 2005/11/07 11:14:26 gleixner Exp $
3 *
4 * drivers/mtd/maps/arctic-mtd.c MTD mappings and partition tables for
5 * IBM 405LP Arctic boards.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Copyright (C) 2002, International Business Machines Corporation
22 * All Rights Reserved.
23 *
24 * Bishop Brock
25 * IBM Research, Austin Center for Low-Power Computing
26 * bcbrock@us.ibm.com
27 * March 2002
28 *
29 * modified for Arctic by,
30 * David Gibson
31 * IBM OzLabs, Canberra, Australia
32 * <arctic@gibson.dropbear.id.au>
33 */
35 #include <linux/kernel.h>
36 #include <linux/module.h>
37 #include <linux/types.h>
38 #include <linux/init.h>
40 #include <linux/mtd/mtd.h>
41 #include <linux/mtd/map.h>
42 #include <linux/mtd/partitions.h>
44 #include <asm/io.h>
45 #include <asm/ibm4xx.h>
47 /*
48 * 0 : 0xFE00 0000 - 0xFEFF FFFF : Filesystem 1 (16MiB)
49 * 1 : 0xFF00 0000 - 0xFF4F FFFF : kernel (5.12MiB)
50 * 2 : 0xFF50 0000 - 0xFFF5 FFFF : Filesystem 2 (10.624MiB) (if non-XIP)
51 * 3 : 0xFFF6 0000 - 0xFFFF FFFF : PIBS Firmware (640KiB)
52 */
54 #define FFS1_SIZE 0x01000000 /* 16MiB */
55 #define KERNEL_SIZE 0x00500000 /* 5.12MiB */
56 #define FFS2_SIZE 0x00a60000 /* 10.624MiB */
57 #define FIRMWARE_SIZE 0x000a0000 /* 640KiB */
60 #define NAME "Arctic Linux Flash"
61 #define PADDR SUBZERO_BOOTFLASH_PADDR
62 #define BUSWIDTH 2
63 #define SIZE SUBZERO_BOOTFLASH_SIZE
64 #define PARTITIONS 4
66 /* Flash memories on these boards are memory resources, accessed big-endian. */
68 {
69 /* do nothing for now */
70 }
72 static struct map_info arctic_mtd_map = {
73 .name = NAME,
74 .size = SIZE,
75 .bankwidth = BUSWIDTH,
76 .phys = PADDR,
77 };
79 static struct mtd_info *arctic_mtd;
81 static struct mtd_partition arctic_partitions[PARTITIONS] = {
82 { .name = "Filesystem",
83 .size = FFS1_SIZE,
84 .offset = 0,},
85 { .name = "Kernel",
86 .size = KERNEL_SIZE,
87 .offset = FFS1_SIZE,},
88 { .name = "Filesystem",
89 .size = FFS2_SIZE,
90 .offset = FFS1_SIZE + KERNEL_SIZE,},
91 { .name = "Firmware",
92 .size = FIRMWARE_SIZE,
93 .offset = SUBZERO_BOOTFLASH_SIZE - FIRMWARE_SIZE,},
94 };
96 static int __init
97 init_arctic_mtd(void)
98 {
99 printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
101 arctic_mtd_map.virt = ioremap(PADDR, SIZE);
103 if (!arctic_mtd_map.virt) {
104 printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
105 return -EIO;
106 }
107 simple_map_init(&arctic_mtd_map);
109 printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
110 arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map);
112 if (!arctic_mtd)
113 return -ENXIO;
115 arctic_mtd->owner = THIS_MODULE;
117 return add_mtd_partitions(arctic_mtd, arctic_partitions, PARTITIONS);
118 }
120 static void __exit
121 cleanup_arctic_mtd(void)
122 {
123 if (arctic_mtd) {
124 del_mtd_partitions(arctic_mtd);
125 map_destroy(arctic_mtd);
126 iounmap((void *) arctic_mtd_map.virt);
127 }
128 }
130 module_init(init_arctic_mtd);
131 module_exit(cleanup_arctic_mtd);
133 MODULE_LICENSE("GPL");
134 MODULE_AUTHOR("David Gibson <arctic@gibson.dropbear.id.au>");
135 MODULE_DESCRIPTION("MTD map and partitions for IBM 405LP Arctic boards");