ia64/linux-2.6.18-xen.hg

view drivers/mtd/maps/dmv182.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
2 /*
3 * drivers/mtd/maps/svme182.c
4 *
5 * Flash map driver for the Dy4 SVME182 board
6 *
7 * $Id: dmv182.c,v 1.6 2005/11/07 11:14:26 gleixner Exp $
8 *
9 * Copyright 2003-2004, TimeSys Corporation
10 *
11 * Based on the SVME181 flash map, by Tom Nelson, Dot4, Inc. for TimeSys Corp.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
19 #include <linux/module.h>
20 #include <linux/init.h>
21 #include <linux/types.h>
22 #include <linux/kernel.h>
23 #include <asm/io.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/map.h>
26 #include <linux/mtd/partitions.h>
27 #include <linux/errno.h>
29 /*
30 * This driver currently handles only the 16MiB user flash bank 1 on the
31 * board. It does not provide access to bank 0 (contains the Dy4 FFW), bank 2
32 * (VxWorks boot), or the optional 48MiB expansion flash.
33 *
34 * scott.wood@timesys.com: On the newer boards with 128MiB flash, it
35 * now supports the first 96MiB (the boot flash bank containing FFW
36 * is excluded). The VxWorks loader is in partition 1.
37 */
39 #define FLASH_BASE_ADDR 0xf0000000
40 #define FLASH_BANK_SIZE (128*1024*1024)
42 MODULE_AUTHOR("Scott Wood, TimeSys Corporation <scott.wood@timesys.com>");
43 MODULE_DESCRIPTION("User-programmable flash device on the Dy4 SVME182 board");
44 MODULE_LICENSE("GPL");
46 static struct map_info svme182_map = {
47 .name = "Dy4 SVME182",
48 .bankwidth = 32,
49 .size = 128 * 1024 * 1024
50 };
52 #define BOOTIMAGE_PART_SIZE ((6*1024*1024)-RESERVED_PART_SIZE)
54 // Allow 6MiB for the kernel
55 #define NEW_BOOTIMAGE_PART_SIZE (6 * 1024 * 1024)
56 // Allow 1MiB for the bootloader
57 #define NEW_BOOTLOADER_PART_SIZE (1024 * 1024)
58 // Use the remaining 9MiB at the end of flash for the RFS
59 #define NEW_RFS_PART_SIZE (0x01000000 - NEW_BOOTLOADER_PART_SIZE - \
60 NEW_BOOTIMAGE_PART_SIZE)
62 static struct mtd_partition svme182_partitions[] = {
63 // The Lower PABS is only 128KiB, but the partition code doesn't
64 // like partitions that don't end on the largest erase block
65 // size of the device, even if all of the erase blocks in the
66 // partition are small ones. The hardware should prevent
67 // writes to the actual PABS areas.
68 {
69 name: "Lower PABS and CPU 0 bootloader or kernel",
70 size: 6*1024*1024,
71 offset: 0,
72 },
73 {
74 name: "Root Filesystem",
75 size: 10*1024*1024,
76 offset: MTDPART_OFS_NXTBLK
77 },
78 {
79 name: "CPU1 Bootloader",
80 size: 1024*1024,
81 offset: MTDPART_OFS_NXTBLK,
82 },
83 {
84 name: "Extra",
85 size: 110*1024*1024,
86 offset: MTDPART_OFS_NXTBLK
87 },
88 {
89 name: "Foundation Firmware and Upper PABS",
90 size: 1024*1024,
91 offset: MTDPART_OFS_NXTBLK,
92 mask_flags: MTD_WRITEABLE // read-only
93 }
94 };
96 static struct mtd_info *this_mtd;
98 static int __init init_svme182(void)
99 {
100 struct mtd_partition *partitions;
101 int num_parts = ARRAY_SIZE(svme182_partitions);
103 partitions = svme182_partitions;
105 svme182_map.virt = ioremap(FLASH_BASE_ADDR, svme182_map.size);
107 if (svme182_map.virt == 0) {
108 printk("Failed to ioremap FLASH memory area.\n");
109 return -EIO;
110 }
112 simple_map_init(&svme182_map);
114 this_mtd = do_map_probe("cfi_probe", &svme182_map);
115 if (!this_mtd)
116 {
117 iounmap((void *)svme182_map.virt);
118 return -ENXIO;
119 }
121 printk(KERN_NOTICE "SVME182 flash device: %dMiB at 0x%08x\n",
122 this_mtd->size >> 20, FLASH_BASE_ADDR);
124 this_mtd->owner = THIS_MODULE;
125 add_mtd_partitions(this_mtd, partitions, num_parts);
127 return 0;
128 }
130 static void __exit cleanup_svme182(void)
131 {
132 if (this_mtd)
133 {
134 del_mtd_partitions(this_mtd);
135 map_destroy(this_mtd);
136 }
138 if (svme182_map.virt)
139 {
140 iounmap((void *)svme182_map.virt);
141 svme182_map.virt = 0;
142 }
144 return;
145 }
147 module_init(init_svme182);
148 module_exit(cleanup_svme182);