ia64/linux-2.6.18-xen.hg

annotate drivers/mtd/maps/beech-mtd.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
rev   line source
ian@0 1 /*
ian@0 2 * $Id: beech-mtd.c,v 1.11 2005/11/07 11:14:26 gleixner Exp $
ian@0 3 *
ian@0 4 * drivers/mtd/maps/beech-mtd.c MTD mappings and partition tables for
ian@0 5 * IBM 405LP Beech boards.
ian@0 6 *
ian@0 7 * This program is free software; you can redistribute it and/or modify
ian@0 8 * it under the terms of the GNU General Public License as published by
ian@0 9 * the Free Software Foundation; either version 2 of the License, or
ian@0 10 * (at your option) any later version.
ian@0 11 *
ian@0 12 * This program is distributed in the hope that it will be useful,
ian@0 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ian@0 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ian@0 15 * GNU General Public License for more details.
ian@0 16 *
ian@0 17 * You should have received a copy of the GNU General Public License
ian@0 18 * along with this program; if not, write to the Free Software
ian@0 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ian@0 20 *
ian@0 21 * Copyright (C) 2002, International Business Machines Corporation
ian@0 22 * All Rights Reserved.
ian@0 23 *
ian@0 24 * Bishop Brock
ian@0 25 * IBM Research, Austin Center for Low-Power Computing
ian@0 26 * bcbrock@us.ibm.com
ian@0 27 * March 2002
ian@0 28 *
ian@0 29 */
ian@0 30
ian@0 31 #include <linux/kernel.h>
ian@0 32 #include <linux/module.h>
ian@0 33 #include <linux/types.h>
ian@0 34 #include <linux/init.h>
ian@0 35
ian@0 36 #include <linux/mtd/mtd.h>
ian@0 37 #include <linux/mtd/map.h>
ian@0 38 #include <linux/mtd/partitions.h>
ian@0 39
ian@0 40 #include <asm/io.h>
ian@0 41 #include <asm/ibm4xx.h>
ian@0 42
ian@0 43 #define NAME "Beech Linux Flash"
ian@0 44 #define PADDR BEECH_BIGFLASH_PADDR
ian@0 45 #define SIZE BEECH_BIGFLASH_SIZE
ian@0 46 #define BUSWIDTH 1
ian@0 47
ian@0 48 /* Flash memories on these boards are memory resources, accessed big-endian. */
ian@0 49
ian@0 50
ian@0 51 static struct map_info beech_mtd_map = {
ian@0 52 .name = NAME,
ian@0 53 .size = SIZE,
ian@0 54 .bankwidth = BUSWIDTH,
ian@0 55 .phys = PADDR
ian@0 56 };
ian@0 57
ian@0 58 static struct mtd_info *beech_mtd;
ian@0 59
ian@0 60 static struct mtd_partition beech_partitions[2] = {
ian@0 61 {
ian@0 62 .name = "Linux Kernel",
ian@0 63 .size = BEECH_KERNEL_SIZE,
ian@0 64 .offset = BEECH_KERNEL_OFFSET
ian@0 65 }, {
ian@0 66 .name = "Free Area",
ian@0 67 .size = BEECH_FREE_AREA_SIZE,
ian@0 68 .offset = BEECH_FREE_AREA_OFFSET
ian@0 69 }
ian@0 70 };
ian@0 71
ian@0 72 static int __init
ian@0 73 init_beech_mtd(void)
ian@0 74 {
ian@0 75 printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
ian@0 76
ian@0 77 beech_mtd_map.virt = ioremap(PADDR, SIZE);
ian@0 78
ian@0 79 if (!beech_mtd_map.virt) {
ian@0 80 printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
ian@0 81 return -EIO;
ian@0 82 }
ian@0 83
ian@0 84 simple_map_init(&beech_mtd_map);
ian@0 85
ian@0 86 printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
ian@0 87 beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map);
ian@0 88
ian@0 89 if (!beech_mtd)
ian@0 90 return -ENXIO;
ian@0 91
ian@0 92 beech_mtd->owner = THIS_MODULE;
ian@0 93
ian@0 94 return add_mtd_partitions(beech_mtd, beech_partitions, 2);
ian@0 95 }
ian@0 96
ian@0 97 static void __exit
ian@0 98 cleanup_beech_mtd(void)
ian@0 99 {
ian@0 100 if (beech_mtd) {
ian@0 101 del_mtd_partitions(beech_mtd);
ian@0 102 map_destroy(beech_mtd);
ian@0 103 iounmap((void *) beech_mtd_map.virt);
ian@0 104 }
ian@0 105 }
ian@0 106
ian@0 107 module_init(init_beech_mtd);
ian@0 108 module_exit(cleanup_beech_mtd);
ian@0 109
ian@0 110 MODULE_LICENSE("GPL");
ian@0 111 MODULE_AUTHOR("Bishop Brock <bcbrock@us.ibm.com>");
ian@0 112 MODULE_DESCRIPTION("MTD map and partitions for IBM 405LP Beech boards");