ia64/linux-2.6.18-xen.hg

view arch/mips/sgi-ip27/ip27-berr.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 * Copyright (C) 1994, 1995, 1996, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 by Silicon Graphics
8 * Copyright (C) 2002 Maciej W. Rozycki
9 */
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/signal.h> /* for SIGBUS */
14 #include <linux/sched.h> /* schow_regs(), force_sig() */
16 #include <asm/module.h>
17 #include <asm/sn/addrs.h>
18 #include <asm/sn/arch.h>
19 #include <asm/sn/sn0/hub.h>
20 #include <asm/tlbdebug.h>
21 #include <asm/traps.h>
22 #include <asm/uaccess.h>
24 extern void dump_tlb_addr(unsigned long addr);
25 extern void dump_tlb_all(void);
27 static void dump_hub_information(unsigned long errst0, unsigned long errst1)
28 {
29 static char *err_type[2][8] = {
30 { NULL, "Uncached Partial Read PRERR", "DERR", "Read Timeout",
31 NULL, NULL, NULL, NULL },
32 { "WERR", "Uncached Partial Write", "PWERR", "Write Timeout",
33 NULL, NULL, NULL, NULL }
34 };
35 int wrb = errst1 & PI_ERR_ST1_WRBRRB_MASK;
37 if (!(errst0 & PI_ERR_ST0_VALID_MASK)) {
38 printk("Hub does not contain valid error information\n");
39 return;
40 }
43 printk("Hub has valid error information:\n");
44 if (errst0 & PI_ERR_ST0_OVERRUN_MASK)
45 printk("Overrun is set. Error stack may contain additional "
46 "information.\n");
47 printk("Hub error address is %08lx\n",
48 (errst0 & PI_ERR_ST0_ADDR_MASK) >> (PI_ERR_ST0_ADDR_SHFT - 3));
49 printk("Incoming message command 0x%lx\n",
50 (errst0 & PI_ERR_ST0_CMD_MASK) >> PI_ERR_ST0_CMD_SHFT);
51 printk("Supplemental field of incoming message is 0x%lx\n",
52 (errst0 & PI_ERR_ST0_SUPPL_MASK) >> PI_ERR_ST0_SUPPL_SHFT);
53 printk("T5 Rn (for RRB only) is 0x%lx\n",
54 (errst0 & PI_ERR_ST0_REQNUM_MASK) >> PI_ERR_ST0_REQNUM_SHFT);
55 printk("Error type is %s\n", err_type[wrb]
56 [(errst0 & PI_ERR_ST0_TYPE_MASK) >> PI_ERR_ST0_TYPE_SHFT]
57 ? : "invalid");
58 }
60 int ip27_be_handler(struct pt_regs *regs, int is_fixup)
61 {
62 unsigned long errst0, errst1;
63 int data = regs->cp0_cause & 4;
64 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
66 if (is_fixup)
67 return MIPS_BE_FIXUP;
69 printk("Slice %c got %cbe at 0x%lx\n", 'A' + cpu, data ? 'd' : 'i',
70 regs->cp0_epc);
71 printk("Hub information:\n");
72 printk("ERR_INT_PEND = 0x%06lx\n", LOCAL_HUB_L(PI_ERR_INT_PEND));
73 errst0 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS0_B : PI_ERR_STATUS0_A);
74 errst1 = LOCAL_HUB_L(cpu ? PI_ERR_STATUS1_B : PI_ERR_STATUS1_A);
75 dump_hub_information(errst0, errst1);
76 show_regs(regs);
77 dump_tlb_all();
78 while(1);
79 force_sig(SIGBUS, current);
80 }
82 void __init ip27_be_init(void)
83 {
84 /* XXX Initialize all the Hub & Bridge error handling here. */
85 int cpu = LOCAL_HUB_L(PI_CPU_NUM);
86 int cpuoff = cpu << 8;
88 board_be_handler = ip27_be_handler;
90 LOCAL_HUB_S(PI_ERR_INT_PEND,
91 cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A);
92 LOCAL_HUB_S(PI_ERR_INT_MASK_A + cpuoff, 0);
93 LOCAL_HUB_S(PI_ERR_STACK_ADDR_A + cpuoff, 0);
94 LOCAL_HUB_S(PI_ERR_STACK_SIZE, 0); /* Disable error stack */
95 LOCAL_HUB_S(PI_SYSAD_ERRCHK_EN, PI_SYSAD_CHECK_ALL);
96 }