ia64/linux-2.6.18-xen.hg

view arch/mips/arc/cmdline.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 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * cmdline.c: Kernel command line creation using ARCS argc/argv.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 */
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/string.h>
14 #include <asm/sgialib.h>
15 #include <asm/bootinfo.h>
17 #undef DEBUG_CMDLINE
19 char * __init prom_getcmdline(void)
20 {
21 return arcs_cmdline;
22 }
24 static char *ignored[] = {
25 "ConsoleIn=",
26 "ConsoleOut=",
27 "SystemPartition=",
28 "OSLoader=",
29 "OSLoadPartition=",
30 "OSLoadFilename=",
31 "OSLoadOptions="
32 };
34 static char *used_arc[][2] = {
35 { "OSLoadPartition=", "root=" },
36 { "OSLoadOptions=", "" }
37 };
39 static char * __init move_firmware_args(char* cp)
40 {
41 char *s;
42 int actr, i;
44 actr = 1; /* Always ignore argv[0] */
46 while (actr < prom_argc) {
47 for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
48 int len = strlen(used_arc[i][0]);
50 if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
51 /* Ok, we want it. First append the replacement... */
52 strcat(cp, used_arc[i][1]);
53 cp += strlen(used_arc[i][1]);
54 /* ... and now the argument */
55 s = strstr(prom_argv(actr), "=");
56 if (s) {
57 s++;
58 strcpy(cp, s);
59 cp += strlen(s);
60 }
61 *cp++ = ' ';
62 break;
63 }
64 }
65 actr++;
66 }
68 return cp;
69 }
71 void __init prom_init_cmdline(void)
72 {
73 char *cp;
74 int actr, i;
76 actr = 1; /* Always ignore argv[0] */
78 cp = arcs_cmdline;
79 /*
80 * Move ARC variables to the beginning to make sure they can be
81 * overridden by later arguments.
82 */
83 cp = move_firmware_args(cp);
85 while (actr < prom_argc) {
86 for (i = 0; i < ARRAY_SIZE(ignored); i++) {
87 int len = strlen(ignored[i]);
89 if (!strncmp(prom_argv(actr), ignored[i], len))
90 goto pic_cont;
91 }
92 /* Ok, we want it. */
93 strcpy(cp, prom_argv(actr));
94 cp += strlen(prom_argv(actr));
95 *cp++ = ' ';
97 pic_cont:
98 actr++;
99 }
101 if (cp != arcs_cmdline) /* get rid of trailing space */
102 --cp;
103 *cp = '\0';
105 #ifdef DEBUG_CMDLINE
106 printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
107 #endif
108 }