ia64/linux-2.6.18-xen.hg

view drivers/mtd/maps/ocotea.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 * Mapping for Ocotea user flash
3 *
4 * Matt Porter <mporter@kernel.crashing.org>
5 *
6 * Copyright 2002-2004 MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/map.h>
20 #include <linux/mtd/partitions.h>
21 #include <asm/io.h>
22 #include <asm/ibm44x.h>
23 #include <platforms/4xx/ocotea.h>
25 static struct mtd_info *flash;
27 static struct map_info ocotea_small_map = {
28 .name = "Ocotea small flash",
29 .size = OCOTEA_SMALL_FLASH_SIZE,
30 .buswidth = 1,
31 };
33 static struct map_info ocotea_large_map = {
34 .name = "Ocotea large flash",
35 .size = OCOTEA_LARGE_FLASH_SIZE,
36 .buswidth = 1,
37 };
39 static struct mtd_partition ocotea_small_partitions[] = {
40 {
41 .name = "pibs",
42 .offset = 0x0,
43 .size = 0x100000,
44 }
45 };
47 static struct mtd_partition ocotea_large_partitions[] = {
48 {
49 .name = "fs",
50 .offset = 0,
51 .size = 0x300000,
52 },
53 {
54 .name = "firmware",
55 .offset = 0x300000,
56 .size = 0x100000,
57 }
58 };
60 int __init init_ocotea(void)
61 {
62 u8 fpga0_reg;
63 u8 *fpga0_adr;
64 unsigned long long small_flash_base, large_flash_base;
66 fpga0_adr = ioremap64(OCOTEA_FPGA_ADDR, 16);
67 if (!fpga0_adr)
68 return -ENOMEM;
70 fpga0_reg = readb((unsigned long)fpga0_adr);
71 iounmap(fpga0_adr);
73 if (OCOTEA_BOOT_LARGE_FLASH(fpga0_reg)) {
74 small_flash_base = OCOTEA_SMALL_FLASH_HIGH;
75 large_flash_base = OCOTEA_LARGE_FLASH_LOW;
76 }
77 else {
78 small_flash_base = OCOTEA_SMALL_FLASH_LOW;
79 large_flash_base = OCOTEA_LARGE_FLASH_HIGH;
80 }
82 ocotea_small_map.phys = small_flash_base;
83 ocotea_small_map.virt = ioremap64(small_flash_base,
84 ocotea_small_map.size);
86 if (!ocotea_small_map.virt) {
87 printk("Failed to ioremap flash\n");
88 return -EIO;
89 }
91 simple_map_init(&ocotea_small_map);
93 flash = do_map_probe("map_rom", &ocotea_small_map);
94 if (flash) {
95 flash->owner = THIS_MODULE;
96 add_mtd_partitions(flash, ocotea_small_partitions,
97 ARRAY_SIZE(ocotea_small_partitions));
98 } else {
99 printk("map probe failed for flash\n");
100 return -ENXIO;
101 }
103 ocotea_large_map.phys = large_flash_base;
104 ocotea_large_map.virt = ioremap64(large_flash_base,
105 ocotea_large_map.size);
107 if (!ocotea_large_map.virt) {
108 printk("Failed to ioremap flash\n");
109 return -EIO;
110 }
112 simple_map_init(&ocotea_large_map);
114 flash = do_map_probe("cfi_probe", &ocotea_large_map);
115 if (flash) {
116 flash->owner = THIS_MODULE;
117 add_mtd_partitions(flash, ocotea_large_partitions,
118 ARRAY_SIZE(ocotea_large_partitions));
119 } else {
120 printk("map probe failed for flash\n");
121 return -ENXIO;
122 }
124 return 0;
125 }
127 static void __exit cleanup_ocotea(void)
128 {
129 if (flash) {
130 del_mtd_partitions(flash);
131 map_destroy(flash);
132 }
134 if (ocotea_small_map.virt) {
135 iounmap((void *)ocotea_small_map.virt);
136 ocotea_small_map.virt = 0;
137 }
139 if (ocotea_large_map.virt) {
140 iounmap((void *)ocotea_large_map.virt);
141 ocotea_large_map.virt = 0;
142 }
143 }
145 module_init(init_ocotea);
146 module_exit(cleanup_ocotea);
148 MODULE_LICENSE("GPL");
149 MODULE_AUTHOR("Matt Porter <mporter@kernel.crashing.org>");
150 MODULE_DESCRIPTION("MTD map and partitions for IBM 440GX Ocotea boards");