[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] libxc reacts to memory allocation delay because memory is on the



ChangeSet 1.1159.256.69, 2005/03/23 09:07:45+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        libxc reacts to memory allocation delay because memory is on the 
        scrub list.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 tools/libxc/xc_private.h |   12 +++++++++++-
 xen/common/domain.c      |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)


diff -Nru a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  2005-03-23 05:03:17 -05:00
+++ b/tools/libxc/xc_private.h  2005-03-23 05:03:17 -05:00
@@ -72,7 +72,7 @@
 
 static inline int do_dom0_op(int xc_handle, dom0_op_t *op)
 {
-    int ret = -1;
+    int ret = -1, retries = 0;
     privcmd_hypercall_t hypercall;
 
     op->interface_version = DOM0_INTERFACE_VERSION;
@@ -86,8 +86,18 @@
         goto out1;
     }
 
+ again:
     if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
     {
+        if ( (errno == EAGAIN) && (retries++ < 10) )
+        {
+            /*
+             * This was added for memory allocation, where we can get EAGAIN
+             * if memory is unavailable because it is on the scrub list.
+             */
+            sleep(1);
+            goto again;
+        }
         if ( errno == EACCES )
             fprintf(stderr, "Dom0 operation failed -- need to"
                     " rebuild the user-space tool set?\n");
diff -Nru a/xen/common/domain.c b/xen/common/domain.c
--- a/xen/common/domain.c       2005-03-23 05:03:17 -05:00
+++ b/xen/common/domain.c       2005-03-23 05:03:17 -05:00
@@ -197,7 +197,7 @@
         if ( unlikely((page = alloc_domheap_page(d)) == NULL) )
         {
             domain_relinquish_memory(d);
-            return -ENOMEM;
+            return list_empty(&page_scrub_list) ? -ENOMEM : -EAGAIN;
         }
 
         /* Initialise the machine-to-phys mapping for this page. */


-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.