ia64/linux-2.6.18-xen.hg

annotate drivers/mtd/maps/pnc2000.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 * pnc2000.c - mapper for Photron PNC-2000 board.
ian@0 3 *
ian@0 4 * Copyright (C) 2000 Crossnet Co. <info@crossnet.co.jp>
ian@0 5 *
ian@0 6 * This code is GPL
ian@0 7 *
ian@0 8 * $Id: pnc2000.c,v 1.18 2005/11/07 11:14:28 gleixner Exp $
ian@0 9 */
ian@0 10
ian@0 11 #include <linux/module.h>
ian@0 12 #include <linux/types.h>
ian@0 13 #include <linux/kernel.h>
ian@0 14 #include <linux/init.h>
ian@0 15
ian@0 16 #include <linux/mtd/mtd.h>
ian@0 17 #include <linux/mtd/map.h>
ian@0 18 #include <linux/mtd/partitions.h>
ian@0 19
ian@0 20
ian@0 21 #define WINDOW_ADDR 0xbf000000
ian@0 22 #define WINDOW_SIZE 0x00400000
ian@0 23
ian@0 24 /*
ian@0 25 * MAP DRIVER STUFF
ian@0 26 */
ian@0 27
ian@0 28
ian@0 29 static struct map_info pnc_map = {
ian@0 30 .name = "PNC-2000",
ian@0 31 .size = WINDOW_SIZE,
ian@0 32 .bankwidth = 4,
ian@0 33 .phys = 0xFFFFFFFF,
ian@0 34 .virt = (void __iomem *)WINDOW_ADDR,
ian@0 35 };
ian@0 36
ian@0 37
ian@0 38 /*
ian@0 39 * MTD 'PARTITIONING' STUFF
ian@0 40 */
ian@0 41 static struct mtd_partition pnc_partitions[3] = {
ian@0 42 {
ian@0 43 .name = "PNC-2000 boot firmware",
ian@0 44 .size = 0x20000,
ian@0 45 .offset = 0
ian@0 46 },
ian@0 47 {
ian@0 48 .name = "PNC-2000 kernel",
ian@0 49 .size = 0x1a0000,
ian@0 50 .offset = 0x20000
ian@0 51 },
ian@0 52 {
ian@0 53 .name = "PNC-2000 filesystem",
ian@0 54 .size = 0x240000,
ian@0 55 .offset = 0x1c0000
ian@0 56 }
ian@0 57 };
ian@0 58
ian@0 59 /*
ian@0 60 * This is the master MTD device for which all the others are just
ian@0 61 * auto-relocating aliases.
ian@0 62 */
ian@0 63 static struct mtd_info *mymtd;
ian@0 64
ian@0 65 static int __init init_pnc2000(void)
ian@0 66 {
ian@0 67 printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
ian@0 68
ian@0 69 simple_map_init(&pnc_map);
ian@0 70
ian@0 71 mymtd = do_map_probe("cfi_probe", &pnc_map);
ian@0 72 if (mymtd) {
ian@0 73 mymtd->owner = THIS_MODULE;
ian@0 74 return add_mtd_partitions(mymtd, pnc_partitions, 3);
ian@0 75 }
ian@0 76
ian@0 77 return -ENXIO;
ian@0 78 }
ian@0 79
ian@0 80 static void __exit cleanup_pnc2000(void)
ian@0 81 {
ian@0 82 if (mymtd) {
ian@0 83 del_mtd_partitions(mymtd);
ian@0 84 map_destroy(mymtd);
ian@0 85 }
ian@0 86 }
ian@0 87
ian@0 88 module_init(init_pnc2000);
ian@0 89 module_exit(cleanup_pnc2000);
ian@0 90
ian@0 91 MODULE_LICENSE("GPL");
ian@0 92 MODULE_AUTHOR("Crossnet Co. <info@crossnet.co.jp>");
ian@0 93 MODULE_DESCRIPTION("MTD map driver for Photron PNC-2000 board");