ia64/linux-2.6.18-xen.hg

view drivers/zorro/names.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 * Zorro Device Name Tables
3 *
4 * Copyright (C) 1999--2000 Geert Uytterhoeven
5 *
6 * Based on the PCI version:
7 *
8 * Copyright 1992--1999 Drew Eckhardt, Frederic Potter,
9 * David Mosberger-Tang, Martin Mares
10 */
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/zorro.h>
18 #ifdef CONFIG_ZORRO_NAMES
20 struct zorro_prod_info {
21 __u16 prod;
22 unsigned short seen;
23 const char *name;
24 };
26 struct zorro_manuf_info {
27 __u16 manuf;
28 unsigned short nr;
29 const char *name;
30 struct zorro_prod_info *prods;
31 };
33 /*
34 * This is ridiculous, but we want the strings in
35 * the .init section so that they don't take up
36 * real memory.. Parse the same file multiple times
37 * to get all the info.
38 */
39 #define MANUF( manuf, name ) static char __manufstr_##manuf[] __initdata = name;
40 #define ENDMANUF()
41 #define PRODUCT( manuf, prod, name ) static char __prodstr_##manuf##prod[] __initdata = name;
42 #include "devlist.h"
45 #define MANUF( manuf, name ) static struct zorro_prod_info __prods_##manuf[] __initdata = {
46 #define ENDMANUF() };
47 #define PRODUCT( manuf, prod, name ) { 0x##prod, 0, __prodstr_##manuf##prod },
48 #include "devlist.h"
50 static struct zorro_manuf_info __initdata zorro_manuf_list[] = {
51 #define MANUF( manuf, name ) { 0x##manuf, sizeof(__prods_##manuf) / sizeof(struct zorro_prod_info), __manufstr_##manuf, __prods_##manuf },
52 #define ENDMANUF()
53 #define PRODUCT( manuf, prod, name )
54 #include "devlist.h"
55 };
57 #define MANUFS (sizeof(zorro_manuf_list)/sizeof(struct zorro_manuf_info))
59 void __init zorro_name_device(struct zorro_dev *dev)
60 {
61 const struct zorro_manuf_info *manuf_p = zorro_manuf_list;
62 int i = MANUFS;
63 char *name = dev->name;
65 do {
66 if (manuf_p->manuf == ZORRO_MANUF(dev->id))
67 goto match_manuf;
68 manuf_p++;
69 } while (--i);
71 /* Couldn't find either the manufacturer nor the product */
72 sprintf(name, "Zorro device %08x", dev->id);
73 return;
75 match_manuf: {
76 struct zorro_prod_info *prod_p = manuf_p->prods;
77 int i = manuf_p->nr;
79 while (i > 0) {
80 if (prod_p->prod ==
81 ((ZORRO_PROD(dev->id)<<8) | ZORRO_EPC(dev->id)))
82 goto match_prod;
83 prod_p++;
84 i--;
85 }
87 /* Ok, found the manufacturer, but unknown product */
88 sprintf(name, "Zorro device %08x (%s)", dev->id, manuf_p->name);
89 return;
91 /* Full match */
92 match_prod: {
93 char *n = name + sprintf(name, "%s %s", manuf_p->name, prod_p->name);
94 int nr = prod_p->seen + 1;
95 prod_p->seen = nr;
96 if (nr > 1)
97 sprintf(n, " (#%d)", nr);
98 }
99 }
100 }
102 #else
104 void __init zorro_name_device(struct zorro_dev *dev)
105 {
106 }
108 #endif