Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 89877e42827f16fa5f86b1df0c2860b1 > files > 2857

kernel-2.6.18-128.1.10.el5.src.rpm

From: Rik van Riel <riel@redhat.com>
Date: Wed, 13 Aug 2008 15:49:29 -0400
Subject: [xen] limit dom0 to 32GB by default
Message-id: 20080813154929.03487abd@cuia.bos.redhat.com
O-Subject: [PATCH RHEL 5.3][2/2] limit dom0 to 32GB by default
Bugzilla: 453467
RH-Acked-by: Chris Lalancette <clalance@redhat.com>
RH-Acked-by: Don Dutile <ddutile@redhat.com>
RH-Acked-by: Bill Burns <bburns@redhat.com>

On very large systems, we end up wasting a lot of resources on dom0, which
will get ballooned down later so there is space for guests.  In fact,
limiting dom0 is necessary in order for the system to succeed booting on
some very large memory systems.

This trivial patch limits dom0 to 32GB memory by default.  This is small
enough that we can boot on 256GB systems, yet large enough that the
default behaviour is not changed for most users.

The amount of dom0 memory can still be overridden on the boot commandline.

Together with patch 1/2, fixes bug 453467.

diff --git a/arch/x86/domain_build.c b/arch/x86/domain_build.c
index e053334..c72c300 100644
--- a/arch/x86/domain_build.c
+++ b/arch/x86/domain_build.c
@@ -35,7 +35,13 @@ extern void discard_initial_images(void);
 
 static long __initdata dom0_nrpages;
 static long __initdata dom0_min_nrpages;
-static long __initdata dom0_max_nrpages = LONG_MAX;
+/*
+ * Limit dom0 memory allocation to 32GB.  This should be large
+ * enough for anything, yet small enough that on the very largest
+ * NUMA systems we do not waste too much memory on dom0 bookkeeping
+ * and keep dom0 memory mostly on one node.
+ */
+static long __initdata dom0_max_nrpages = 32L << (30 - PAGE_SHIFT);
 
 /*
  * dom0_mem=[min:<min_amt>,][max:<max_amt>,][<amt>]
@@ -139,6 +145,9 @@ static unsigned long __init compute_dom0_nr_pages(void)
         dom0_nrpages = avail;
         dom0_nrpages = min(dom0_nrpages / 16, 128L << (20 - PAGE_SHIFT));
         dom0_nrpages = -dom0_nrpages;
+    } else {
+        /* User specified a dom0_size.  Do not clamp the maximum. */
+        dom0_max_nrpages = LONG_MAX;
     }
 
     /* Negative memory specification means "all memory - specified amount". */