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-changelog

[Xen-changelog] libxc reacts to memory allocation delay because memory i

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] libxc reacts to memory allocation delay because memory is on the
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 23 Mar 2005 09:07:45 +0000
Delivery-date: Wed, 23 Mar 2005 15:00:37 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
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

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