ia64/linux-2.6.18-xen.hg

annotate arch/sparc/lib/iomap.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
rev   line source
ian@0 1 /*
ian@0 2 * Implement the sparc iomap interfaces
ian@0 3 */
ian@0 4 #include <linux/pci.h>
ian@0 5 #include <linux/module.h>
ian@0 6 #include <asm/io.h>
ian@0 7
ian@0 8 /* Create a virtual mapping cookie for an IO port range */
ian@0 9 void __iomem *ioport_map(unsigned long port, unsigned int nr)
ian@0 10 {
ian@0 11 return (void __iomem *) (unsigned long) port;
ian@0 12 }
ian@0 13
ian@0 14 void ioport_unmap(void __iomem *addr)
ian@0 15 {
ian@0 16 /* Nothing to do */
ian@0 17 }
ian@0 18 EXPORT_SYMBOL(ioport_map);
ian@0 19 EXPORT_SYMBOL(ioport_unmap);
ian@0 20
ian@0 21 /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
ian@0 22 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
ian@0 23 {
ian@0 24 unsigned long start = pci_resource_start(dev, bar);
ian@0 25 unsigned long len = pci_resource_len(dev, bar);
ian@0 26 unsigned long flags = pci_resource_flags(dev, bar);
ian@0 27
ian@0 28 if (!len || !start)
ian@0 29 return NULL;
ian@0 30 if (maxlen && len > maxlen)
ian@0 31 len = maxlen;
ian@0 32 if (flags & IORESOURCE_IO)
ian@0 33 return ioport_map(start, len);
ian@0 34 if (flags & IORESOURCE_MEM) {
ian@0 35 if (flags & IORESOURCE_CACHEABLE)
ian@0 36 return ioremap(start, len);
ian@0 37 return ioremap_nocache(start, len);
ian@0 38 }
ian@0 39 /* What? */
ian@0 40 return NULL;
ian@0 41 }
ian@0 42
ian@0 43 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
ian@0 44 {
ian@0 45 /* nothing to do */
ian@0 46 }
ian@0 47 EXPORT_SYMBOL(pci_iomap);
ian@0 48 EXPORT_SYMBOL(pci_iounmap);