* [PATCH] add dom0_max_mem hypervisor boot option
@ 2006-10-31 19:42 Ben Thomas
0 siblings, 0 replies; only message in thread
From: Ben Thomas @ 2006-10-31 19:42 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]
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@virtualiron.com)
--
------------------------------------------------------------------------
Ben Thomas Virtual Iron Software
bthomas@virtualiron.com Tower 1, Floor 2
978-849-1214 900 Chelmsford Street
Lowell, MA 01851
[-- Attachment #2: 10238_dom0_max_mem.patch --]
[-- Type: text/x-patch, Size: 2501 bytes --]
# 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@virtualiron.com)
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". */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-10-31 19:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31 19:42 [PATCH] add dom0_max_mem hypervisor boot option Ben Thomas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.