ia64/linux-2.6.18-xen.hg

view drivers/net/ixp2000/ixpdev_priv.h @ 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 * IXP2000 MSF network device driver
3 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
4 * Dedicated to Marija Kulikova.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
12 #ifndef __IXPDEV_PRIV_H
13 #define __IXPDEV_PRIV_H
15 #define RX_BUF_DESC_BASE 0x00001000
16 #define RX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_rx_desc)))
17 #define TX_BUF_DESC_BASE 0x00002000
18 #define TX_BUF_COUNT ((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_tx_desc)))
19 #define TX_BUF_COUNT_PER_CHAN (TX_BUF_COUNT / 4)
21 #define RING_RX_PENDING ((u32 *)IXP2000_SCRATCH_RING_VIRT_BASE)
22 #define RING_RX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 4))
23 #define RING_TX_PENDING ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 8))
24 #define RING_TX_DONE ((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 12))
26 #define SCRATCH_REG(x) ((u32 *)(IXP2000_GLOBAL_REG_VIRT_BASE | 0x0800 | (x)))
27 #define RING_RX_PENDING_BASE SCRATCH_REG(0x00)
28 #define RING_RX_PENDING_HEAD SCRATCH_REG(0x04)
29 #define RING_RX_PENDING_TAIL SCRATCH_REG(0x08)
30 #define RING_RX_DONE_BASE SCRATCH_REG(0x10)
31 #define RING_RX_DONE_HEAD SCRATCH_REG(0x14)
32 #define RING_RX_DONE_TAIL SCRATCH_REG(0x18)
33 #define RING_TX_PENDING_BASE SCRATCH_REG(0x20)
34 #define RING_TX_PENDING_HEAD SCRATCH_REG(0x24)
35 #define RING_TX_PENDING_TAIL SCRATCH_REG(0x28)
36 #define RING_TX_DONE_BASE SCRATCH_REG(0x30)
37 #define RING_TX_DONE_HEAD SCRATCH_REG(0x34)
38 #define RING_TX_DONE_TAIL SCRATCH_REG(0x38)
40 struct ixpdev_rx_desc
41 {
42 u32 buf_addr;
43 u32 buf_length;
44 u32 channel;
45 u32 pkt_length;
46 };
48 struct ixpdev_tx_desc
49 {
50 u32 buf_addr;
51 u32 pkt_length;
52 u32 channel;
53 u32 unused;
54 };
57 #endif