|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [linux-2.6.18-xen] linux/balloon: don't allow ballooning
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207431409 -3600
# Node ID b61443b1bf7690f421dbdfbcd62cf83497deb4a0
# Parent 0d6c9c975eaee85e35d4007b1b84cafbfbb24378
linux/balloon: don't allow ballooning down a domain below a reasonable limit
Reasonable is hard to judge; we don't want to disallow small domains.
But the system needs a reasonable amount of memory to perform its
duties, set up tables, etc. If on the other hand, the admin is able
to set up and boot up correctly a very small domain, there's no point
in forcing it to be larger. We end up with some kind of logarithmic
function, approximated.
Signed-off-by: Kurt Garloff <garloff@xxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
drivers/xen/balloon/balloon.c | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletion(-)
diff -r 0d6c9c975eae -r b61443b1bf76 drivers/xen/balloon/balloon.c
--- a/drivers/xen/balloon/balloon.c Fri Apr 04 13:27:48 2008 +0100
+++ b/drivers/xen/balloon/balloon.c Sat Apr 05 22:36:49 2008 +0100
@@ -194,6 +194,41 @@ static unsigned long current_target(void
return target;
}
+static unsigned long minimum_target(void)
+{
+#ifndef CONFIG_XEN
+ return 0;
+#else
+ unsigned long min_pages, curr_pages = current_target();
+
+#define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
+ /* Simple continuous piecewiese linear function:
+ * max MiB -> min MiB gradient
+ * 0 0
+ * 16 16
+ * 32 24
+ * 128 72 (1/2)
+ * 512 168 (1/4)
+ * 2048 360 (1/8)
+ * 8192 552 (1/32)
+ * 32768 1320
+ * 131072 4392
+ */
+ if (max_pfn < MB2PAGES(128))
+ min_pages = MB2PAGES(8) + (max_pfn >> 1);
+ else if (max_pfn < MB2PAGES(512))
+ min_pages = MB2PAGES(40) + (max_pfn >> 2);
+ else if (max_pfn < MB2PAGES(2048))
+ min_pages = MB2PAGES(104) + (max_pfn >> 3);
+ else
+ min_pages = MB2PAGES(296) + (max_pfn >> 5);
+#undef MB2PAGES
+
+ /* Don't enforce growth */
+ return min(min_pages, curr_pages);
+#endif
+}
+
static int increase_reservation(unsigned long nr_pages)
{
unsigned long pfn, i, flags;
@@ -384,7 +419,7 @@ void balloon_set_new_target(unsigned lon
{
/* No need for lock. Not read-modify-write updates. */
bs.hard_limit = ~0UL;
- bs.target_pages = target;
+ bs.target_pages = max(target, minimum_target());
schedule_work(&balloon_worker);
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [linux-2.6.18-xen] linux/balloon: don't allow ballooning down a domain below a reasonable limit,
Xen patchbot-linux-2.6.18-xen <=
|
|
|
|
|