ia64/linux-2.6.18-xen.hg

view drivers/mtd/maps/lasat.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 * Flash device on Lasat 100 and 200 boards
3 *
4 * (C) 2002 Brian Murphy <brian@murphy.dk>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 *
10 * $Id: lasat.c,v 1.9 2004/11/04 13:24:15 gleixner Exp $
11 *
12 */
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <asm/io.h>
19 #include <linux/mtd/mtd.h>
20 #include <linux/mtd/map.h>
21 #include <linux/mtd/partitions.h>
22 #include <asm/lasat/lasat.h>
24 static struct mtd_info *lasat_mtd;
26 static struct mtd_partition partition_info[LASAT_MTD_LAST];
27 static char *lasat_mtd_partnames[] = {"Bootloader", "Service", "Normal", "Filesystem", "Config"};
29 static void lasat_set_vpp(struct map_info *map, int vpp)
30 {
31 if (vpp)
32 *lasat_misc->flash_wp_reg |= 1 << lasat_misc->flash_wp_bit;
33 else
34 *lasat_misc->flash_wp_reg &= ~(1 << lasat_misc->flash_wp_bit);
35 }
37 static struct map_info lasat_map = {
38 .name = "LASAT flash",
39 .bankwidth = 4,
40 .set_vpp = lasat_set_vpp
41 };
43 static int __init init_lasat(void)
44 {
45 int i;
46 /* since we use AMD chips and set_vpp is not implimented
47 * for these (yet) we still have to permanently enable flash write */
48 printk(KERN_NOTICE "Unprotecting flash\n");
49 ENABLE_VPP((&lasat_map));
51 lasat_map.phys = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
52 lasat_map.virt = ioremap_nocache(
53 lasat_map.phys, lasat_board_info.li_flash_size);
54 lasat_map.size = lasat_board_info.li_flash_size;
56 simple_map_init(&lasat_map);
58 for (i=0; i < LASAT_MTD_LAST; i++)
59 partition_info[i].name = lasat_mtd_partnames[i];
61 lasat_mtd = do_map_probe("cfi_probe", &lasat_map);
63 if (!lasat_mtd)
64 lasat_mtd = do_map_probe("jedec_probe", &lasat_map);
66 if (lasat_mtd) {
67 u32 size, offset = 0;
69 lasat_mtd->owner = THIS_MODULE;
71 for (i=0; i < LASAT_MTD_LAST; i++) {
72 size = lasat_flash_partition_size(i);
73 partition_info[i].size = size;
74 partition_info[i].offset = offset;
75 offset += size;
76 }
78 add_mtd_partitions( lasat_mtd, partition_info, LASAT_MTD_LAST );
79 return 0;
80 }
82 return -ENXIO;
83 }
85 static void __exit cleanup_lasat(void)
86 {
87 if (lasat_mtd) {
88 del_mtd_partitions(lasat_mtd);
89 map_destroy(lasat_mtd);
90 }
91 if (lasat_map.virt) {
92 lasat_map.virt = 0;
93 }
94 }
96 module_init(init_lasat);
97 module_exit(cleanup_lasat);
99 MODULE_LICENSE("GPL");
100 MODULE_AUTHOR("Brian Murphy <brian@murphy.dk>");
101 MODULE_DESCRIPTION("Lasat Safepipe/Masquerade MTD map driver");