If you want to set dom0 to a specific memory size on a specific
machine, you can use the hypervisor boot option, dom0_mem. However,
when working with a number of nodes, you may simply want to cap
dom0 memory usage without regard to the specific amount of memory
on each node. FOr this case, you cannot use dom0_mem, as the node
must have that much memory or more. For this case, the boot option
dom0_max_mem was added. If dom0_mem is unspecified (to preserve
current behavior), it will act as a ceiling/cap on the amount of
memory available to construct dom0. Nodes with less memory will
continue to use all of their memory; nodes with more will apply
only the specified portion to dom0. Many words - simple idea.
Simple example: dom0 on all nodes should be 2GB or less, use the
option dom0_max_mem=2G
Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx)
--
------------------------------------------------------------------------
Ben Thomas Virtual Iron Software
bthomas@xxxxxxxxxxxxxxx Tower 1, Floor 2
978-849-1214 900 Chelmsford Street
Lowell, MA 01851
# If you want to set dom0 to a specific memory size on a specific machine,
# you use dom0_mem. However, if you simply want to cap dom0 memory usage
# across a number of machine, regardless of size, you can't use dom0_mem.
# Add the hypervisor argument dom0_max_mem to allow this type of operation.
# dom0 memory will be capped. It might be less, but never more.
#
# Simple example: all dom0 on all nodes should be 2GB or less, use the
# option dom0_max_mem=2GB.
#
# Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx)
Index: xen-unstable.hg/xen/arch/x86/domain_build.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/x86/domain_build.c 2006-10-30
11:13:48.000000000 -0500
+++ xen-unstable.hg/xen/arch/x86/domain_build.c 2006-10-30 11:15:26.000000000
-0500
@@ -58,6 +58,32 @@
}
custom_param("dom0_mem", parse_dom0_mem);
+static long dom0_max_nrpages;
+
+/*
+ * dom0_max_mem:
+ * This parameter is used to specify a maximum size for dom0.
+ * If there is less memory, that's ok. If there's more, it's
+ * capped at this limit.
+ *
+ * Note that this is only valid if dom0_mem is 0 (unspecified)
+ */
+
+static void parse_dom0_max_mem(char *s)
+{
+ unsigned long long bytes;
+ char *t = s;
+ if ( *s == '-' )
+ {
+ printk("dom0_max_mem must be >= 0\n");
+ return;
+ }
+
+ bytes = parse_size_and_unit(t);
+ dom0_max_nrpages = bytes >> PAGE_SHIFT;
+}
+custom_param("dom0_max_mem", parse_dom0_max_mem);
+
static unsigned int opt_dom0_max_vcpus;
integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
@@ -209,6 +235,7 @@
unsigned long alloc_spfn;
unsigned long alloc_epfn;
unsigned long count;
+ long dom0_res_pages;
struct page_info *page = NULL;
start_info_t *si;
struct vcpu *v = d->vcpu[0];
@@ -277,8 +304,14 @@
if ( dom0_nrpages == 0 )
{
dom0_nrpages = avail_domheap_pages() + initial_images_nrpages();
- dom0_nrpages = min(dom0_nrpages / 16, 128L << (20 - PAGE_SHIFT));
- dom0_nrpages = -dom0_nrpages;
+ dom0_res_pages = min(dom0_nrpages / 16, 128L << (20 - PAGE_SHIFT));
+ dom0_nrpages -= dom0_res_pages;
+ if ( (dom0_max_nrpages > 0) && (dom0_nrpages > dom0_max_nrpages) )
+ {
+ printk("Limiting dom0 pages from %lu to %lu\n",
+ dom0_nrpages, dom0_max_nrpages);
+ dom0_nrpages = dom0_max_nrpages;
+ }
}
/* Negative memory specification means "all memory - specified amount". */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|