WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 3/3] xen: use maximum reservation to limit dom0 memor

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3/3] xen: use maximum reservation to limit dom0 memory
From: David Vrabel <david.vrabel@xxxxxxxxxx>
Date: Tue, 16 Aug 2011 11:00:38 +0100
Cc: David Vrabel <david.vrabel@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Tue, 16 Aug 2011 03:10:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1313488838-28809-1-git-send-email-david.vrabel@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1313488838-28809-1-git-send-email-david.vrabel@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Use the maximum reservation hypercall to set limit the amount of
usable dom0 memory.  This reduces the size of pages tables etc. if
dom0 is to use less memory than the maximum available.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
Note this requires a patched Xen that sets max_pages when creating dom0.
---
 arch/x86/xen/setup.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 3421c9e..584e7dc 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -197,7 +197,12 @@ static unsigned long __init xen_get_max_pages(void)
        unsigned long max_pages = MAX_DOMAIN_PAGES; /* Limited by memory map. */
 
        if (xen_initial_domain()) {
-               /* FIXME: ask hypervisor for max pages. */
+               domid_t domid = DOMID_SELF;
+               int ret;
+
+               ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
+               if (ret > 0)
+                       max_pages = ret;
        }
 
        return min(max_pages, MAX_DOMAIN_PAGES);
-- 
1.7.4.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>