ia64/linux-2.6.18-xen.hg

view drivers/mtd/maps/ebony.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: ebony.c,v 1.16 2005/11/07 11:14:26 gleixner Exp $
3 *
4 * Mapping for Ebony user flash
5 *
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * Copyright 2002-2004 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
16 #include <linux/module.h>
17 #include <linux/types.h>
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/partitions.h>
23 #include <asm/io.h>
24 #include <asm/ibm44x.h>
25 #include <platforms/4xx/ebony.h>
27 static struct mtd_info *flash;
29 static struct map_info ebony_small_map = {
30 .name = "Ebony small flash",
31 .size = EBONY_SMALL_FLASH_SIZE,
32 .bankwidth = 1,
33 };
35 static struct map_info ebony_large_map = {
36 .name = "Ebony large flash",
37 .size = EBONY_LARGE_FLASH_SIZE,
38 .bankwidth = 1,
39 };
41 static struct mtd_partition ebony_small_partitions[] = {
42 {
43 .name = "OpenBIOS",
44 .offset = 0x0,
45 .size = 0x80000,
46 }
47 };
49 static struct mtd_partition ebony_large_partitions[] = {
50 {
51 .name = "fs",
52 .offset = 0,
53 .size = 0x380000,
54 },
55 {
56 .name = "firmware",
57 .offset = 0x380000,
58 .size = 0x80000,
59 }
60 };
62 int __init init_ebony(void)
63 {
64 u8 fpga0_reg;
65 u8 __iomem *fpga0_adr;
66 unsigned long long small_flash_base, large_flash_base;
68 fpga0_adr = ioremap64(EBONY_FPGA_ADDR, 16);
69 if (!fpga0_adr)
70 return -ENOMEM;
72 fpga0_reg = readb(fpga0_adr);
73 iounmap(fpga0_adr);
75 if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
76 !EBONY_FLASH_SEL(fpga0_reg))
77 small_flash_base = EBONY_SMALL_FLASH_HIGH2;
78 else if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
79 EBONY_FLASH_SEL(fpga0_reg))
80 small_flash_base = EBONY_SMALL_FLASH_HIGH1;
81 else if (!EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
82 !EBONY_FLASH_SEL(fpga0_reg))
83 small_flash_base = EBONY_SMALL_FLASH_LOW2;
84 else
85 small_flash_base = EBONY_SMALL_FLASH_LOW1;
87 if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
88 !EBONY_ONBRD_FLASH_EN(fpga0_reg))
89 large_flash_base = EBONY_LARGE_FLASH_LOW;
90 else
91 large_flash_base = EBONY_LARGE_FLASH_HIGH;
93 ebony_small_map.phys = small_flash_base;
94 ebony_small_map.virt = ioremap64(small_flash_base,
95 ebony_small_map.size);
97 if (!ebony_small_map.virt) {
98 printk("Failed to ioremap flash\n");
99 return -EIO;
100 }
102 simple_map_init(&ebony_small_map);
104 flash = do_map_probe("jedec_probe", &ebony_small_map);
105 if (flash) {
106 flash->owner = THIS_MODULE;
107 add_mtd_partitions(flash, ebony_small_partitions,
108 ARRAY_SIZE(ebony_small_partitions));
109 } else {
110 printk("map probe failed for flash\n");
111 return -ENXIO;
112 }
114 ebony_large_map.phys = large_flash_base;
115 ebony_large_map.virt = ioremap64(large_flash_base,
116 ebony_large_map.size);
118 if (!ebony_large_map.virt) {
119 printk("Failed to ioremap flash\n");
120 return -EIO;
121 }
123 simple_map_init(&ebony_large_map);
125 flash = do_map_probe("jedec_probe", &ebony_large_map);
126 if (flash) {
127 flash->owner = THIS_MODULE;
128 add_mtd_partitions(flash, ebony_large_partitions,
129 ARRAY_SIZE(ebony_large_partitions));
130 } else {
131 printk("map probe failed for flash\n");
132 return -ENXIO;
133 }
135 return 0;
136 }
138 static void __exit cleanup_ebony(void)
139 {
140 if (flash) {
141 del_mtd_partitions(flash);
142 map_destroy(flash);
143 }
145 if (ebony_small_map.virt) {
146 iounmap(ebony_small_map.virt);
147 ebony_small_map.virt = NULL;
148 }
150 if (ebony_large_map.virt) {
151 iounmap(ebony_large_map.virt);
152 ebony_large_map.virt = NULL;
153 }
154 }
156 module_init(init_ebony);
157 module_exit(cleanup_ebony);
159 MODULE_LICENSE("GPL");
160 MODULE_AUTHOR("Matt Porter <mporter@kernel.crashing.org>");
161 MODULE_DESCRIPTION("MTD map and partitions for IBM 440GP Ebony boards");