ia64/linux-2.6.18-xen.hg

view arch/sparc64/kernel/iommu_common.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 /* $Id: iommu_common.h,v 1.5 2001/12/11 09:41:01 davem Exp $
2 * iommu_common.h: UltraSparc SBUS/PCI common iommu declarations.
3 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */
7 #include <linux/kernel.h>
8 #include <linux/types.h>
9 #include <linux/sched.h>
10 #include <linux/mm.h>
12 #include <asm/iommu.h>
13 #include <asm/scatterlist.h>
15 /*
16 * These give mapping size of each iommu pte/tlb.
17 */
18 #define IO_PAGE_SHIFT 13
19 #define IO_PAGE_SIZE (1UL << IO_PAGE_SHIFT)
20 #define IO_PAGE_MASK (~(IO_PAGE_SIZE-1))
21 #define IO_PAGE_ALIGN(addr) (((addr)+IO_PAGE_SIZE-1)&IO_PAGE_MASK)
23 #define IO_TSB_ENTRIES (128*1024)
24 #define IO_TSB_SIZE (IO_TSB_ENTRIES * 8)
26 /*
27 * This is the hardwired shift in the iotlb tag/data parts.
28 */
29 #define IOMMU_PAGE_SHIFT 13
31 /* You are _strongly_ advised to enable the following debugging code
32 * any time you make changes to the sg code below, run it for a while
33 * with filesystems mounted read-only before buying the farm... -DaveM
34 */
35 #undef VERIFY_SG
37 #ifdef VERIFY_SG
38 extern void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int npages);
39 #endif
41 /* Two addresses are "virtually contiguous" if and only if:
42 * 1) They are equal, or...
43 * 2) They are both on a page boundary
44 */
45 #define VCONTIG(__X, __Y) (((__X) == (__Y)) || \
46 (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL)
48 extern unsigned long prepare_sg(struct scatterlist *sg, int nents);