ia64/linux-2.6.18-xen.hg

view drivers/net/dgrs_ether.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 * A filtering function. There are two filters/port. Filter "0"
3 * is the input filter, and filter "1" is the output filter.
4 */
5 typedef int (FILTER_FUNC)(uchar *pktp, int pktlen, ulong *scratch, int port);
6 #define NFILTERS 2
8 /*
9 * The per port structure
10 */
11 typedef struct
12 {
13 int chan; /* Channel number (0-3) */
14 ulong portaddr; /* address of 596 port register */
15 volatile ulong *ca; /* address of 596 chan attention */
16 ulong intmask; /* Interrupt mask for this port */
17 ulong intack; /* Ack bit for this port */
19 uchar ethaddr[6]; /* Ethernet address of this port */
20 int is_promisc; /* Port is promiscuous */
22 int debug; /* Debugging turned on */
24 I596_ISCP *iscpp; /* Uncached ISCP pointer */
25 I596_SCP *scpp; /* Uncached SCP pointer */
26 I596_SCB *scbp; /* Uncached SCB pointer */
28 I596_ISCP iscp;
29 I596_SCB scb;
31 /* Command Queue */
32 I596_CB *cb0;
33 I596_CB *cbN;
34 I596_CB *cb_head;
35 I596_CB *cb_tail;
37 /* Receive Queue */
38 I596_RFD *rfd0;
39 I596_RFD *rfdN;
40 I596_RFD *rfd_head;
41 I596_RFD *rfd_tail;
43 /* Receive Buffers */
44 I596_RBD *rbd0;
45 I596_RBD *rbdN;
46 I596_RBD *rbd_head;
47 I596_RBD *rbd_tail;
48 int buf_size; /* Size of an RBD buffer */
49 int buf_cnt; /* Total RBD's allocated */
51 /* Rx Statistics */
52 ulong cnt_rx_cnt; /* Total packets rcvd, good and bad */
53 ulong cnt_rx_good; /* Total good packets rcvd */
54 ulong cnt_rx_bad; /* Total of all bad packets rcvd */
55 /* Subtotals can be gotten from SCB */
56 ulong cnt_rx_nores; /* No resources */
57 ulong cnt_rx_bytes; /* Total bytes rcvd */
59 /* Tx Statistics */
60 ulong cnt_tx_queued;
61 ulong cnt_tx_done;
62 ulong cnt_tx_freed;
63 ulong cnt_tx_nores; /* No resources */
65 ulong cnt_tx_bad;
66 ulong cnt_tx_err_late;
67 ulong cnt_tx_err_nocrs;
68 ulong cnt_tx_err_nocts;
69 ulong cnt_tx_err_under;
70 ulong cnt_tx_err_maxcol;
71 ulong cnt_tx_collisions;
73 /* Special stuff for host */
74 # define rfd_freed cnt_rx_cnt
75 ulong rbd_freed;
76 int host_timer;
78 /* Added after first beta */
79 ulong cnt_tx_races; /* Counts race conditions */
80 int spanstate;
81 ulong cnt_st_tx; /* send span tree pkts */
82 ulong cnt_st_fail_tx; /* Failures to send span tree pkts */
83 ulong cnt_st_fail_rbd;/* Failures to send span tree pkts */
84 ulong cnt_st_rx; /* rcv span tree pkts */
85 ulong cnt_st_rx_bad; /* bogus st packets rcvd */
86 ulong cnt_rx_fwd; /* Rcvd packets that were forwarded */
88 ulong cnt_rx_mcast; /* Multicast pkts received */
89 ulong cnt_tx_mcast; /* Multicast pkts transmitted */
90 ulong cnt_tx_bytes; /* Bytes transmitted */
92 /*
93 * Packet filtering
94 * Filter 0: input filter
95 * Filter 1: output filter
96 */
98 ulong *filter_space[NFILTERS];
99 FILTER_FUNC *filter_func[NFILTERS];
100 ulong filter_cnt[NFILTERS];
101 ulong filter_len[NFILTERS];
103 ulong pad[ (512-300) / 4];
104 } PORT;
106 /*
107 * Port[0] is host interface
108 * Port[1..SE_NPORTS] are external 10 Base T ports. Fewer may be in
109 * use, depending on whether this is an SE-4 or
110 * an SE-6.
111 * Port[SE_NPORTS] Pseudo-port for Spanning tree and SNMP
112 */
113 extern PORT Port[1+SE_NPORTS+1];
115 extern int Nports; /* Number of genuine ethernet controllers */
116 extern int Nchan; /* ... plus one for host interface */
118 extern int FirstChan; /* 0 or 1, depedning on whether host is used */
119 extern int NumChan; /* 4 or 5 */
121 /*
122 * A few globals
123 */
124 extern int IsPromisc;
125 extern int MultiNicMode;
127 /*
128 * Functions
129 */
130 extern void eth_xmit_spew_on(PORT *p, int cnt);
131 extern void eth_xmit_spew_off(PORT *p);
133 extern I596_RBD *alloc_rbds(PORT *p, int num);
135 extern I596_CB * eth_cb_alloc(PORT *p);