ia64/linux-2.6.18-xen.hg

view drivers/mtd/maps/mbx860.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: mbx860.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $
3 *
4 * Handle mapping of the flash on MBX860 boards
5 *
6 * Author: Anton Todorov
7 * Copyright: (C) 2001 Emness Technology
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
15 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <asm/io.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/partitions.h>
25 #define WINDOW_ADDR 0xfe000000
26 #define WINDOW_SIZE 0x00200000
28 /* Flash / Partition sizing */
29 #define MAX_SIZE_KiB 8192
30 #define BOOT_PARTITION_SIZE_KiB 512
31 #define KERNEL_PARTITION_SIZE_KiB 5632
32 #define APP_PARTITION_SIZE_KiB 2048
34 #define NUM_PARTITIONS 3
36 /* partition_info gives details on the logical partitions that the split the
37 * single flash device into. If the size if zero we use up to the end of the
38 * device. */
39 static struct mtd_partition partition_info[]={
40 { .name = "MBX flash BOOT partition",
41 .offset = 0,
42 .size = BOOT_PARTITION_SIZE_KiB*1024 },
43 { .name = "MBX flash DATA partition",
44 .offset = BOOT_PARTITION_SIZE_KiB*1024,
45 .size = (KERNEL_PARTITION_SIZE_KiB)*1024 },
46 { .name = "MBX flash APPLICATION partition",
47 .offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
48 };
51 static struct mtd_info *mymtd;
53 struct map_info mbx_map = {
54 .name = "MBX flash",
55 .size = WINDOW_SIZE,
56 .phys = WINDOW_ADDR,
57 .bankwidth = 4,
58 };
60 int __init init_mbx(void)
61 {
62 printk(KERN_NOTICE "Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE*4, WINDOW_ADDR);
63 mbx_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
65 if (!mbx_map.virt) {
66 printk("Failed to ioremap\n");
67 return -EIO;
68 }
69 simple_map_init(&mbx_map);
71 mymtd = do_map_probe("jedec_probe", &mbx_map);
72 if (mymtd) {
73 mymtd->owner = THIS_MODULE;
74 add_mtd_device(mymtd);
75 add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
76 return 0;
77 }
79 iounmap((void *)mbx_map.virt);
80 return -ENXIO;
81 }
83 static void __exit cleanup_mbx(void)
84 {
85 if (mymtd) {
86 del_mtd_device(mymtd);
87 map_destroy(mymtd);
88 }
89 if (mbx_map.virt) {
90 iounmap((void *)mbx_map.virt);
91 mbx_map.virt = 0;
92 }
93 }
95 module_init(init_mbx);
96 module_exit(cleanup_mbx);
98 MODULE_AUTHOR("Anton Todorov <a.todorov@emness.com>");
99 MODULE_DESCRIPTION("MTD map driver for Motorola MBX860 board");
100 MODULE_LICENSE("GPL");