# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID b17300195f02f7da17f3ad94aed955863ffd4fed
# Parent  b35682af48d01ddba1d26e6fe2d0c5607a343228
[TOOLS][POWERPC] no need to allocate extents in a loop

This patch decreases the number of hcalls needed to allocate all the
extents for a domain with large amounts of memory.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 tools/python/xen/xend/XendDomainInfo.py |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff -r b35682af48d0 -r b17300195f02 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Nov 13 14:32:55 2006 -0600
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Nov 14 19:46:26 2006 -0500
@@ -2017,6 +2017,10 @@ class XendDomainInfo (Common_XendDomainI
         if memory < rma_kb:
             raise ValueError("Domain memory must be at least %d KB" % rma_kb)
 
+        if memory & (16 << 10):
+            raise ValueError("Domain memory %dKB must be a multiple of 16MB"
+                             % memory)
+
         # allocate the RMA
         log.debug("alloc_real_mode_area(%d, %d)", self.domid, rma_log)
         xc.alloc_real_mode_area(self.domid, rma_log)
@@ -2024,13 +2028,11 @@ class XendDomainInfo (Common_XendDomainI
         # now allocate the remaining memory as large-order allocations
         memory -= rma_kb
         extent_log = 24 # 16 MB
-        extent_size = 1 << extent_log
         page_log = 12 # 4 KB
         extent_order = extent_log - page_log
-        for i in range(0, memory * 1024, extent_size):
-            log.debug("increase_reservation(%d, 0x%x, %d)", self.domid,
-                    extent_size >> 10, extent_order)
-            xc.domain_memory_increase_reservation(self.domid,
-                                                  extent_size >> 10,
-                                                  extent_order)
-
+        log.debug("increase_reservation(%d, 0x%x, %d)", self.domid,
+                  memory, extent_order)
+        xc.domain_memory_increase_reservation(self.domid,
+                                              memory,
+                                              extent_order)
+

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

Reply via email to