ia64/xen-unstable

changeset 4271:5cc6d3dc47d0

bitkeeper revision 1.1159.272.9 (424131e1AxW6hgsgUY2M3meFO0k4MQ)

libxc reacts to memory allocation delay because memory is on the
scrub list.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Mar 23 09:07:45 2005 +0000 (2005-03-23)
parents 3868fc815598
children bc69e161b5fe 573e67095682
files tools/libxc/xc_private.h xen/common/domain.c
line diff
     1.1 --- a/tools/libxc/xc_private.h	Tue Mar 22 19:26:37 2005 +0000
     1.2 +++ b/tools/libxc/xc_private.h	Wed Mar 23 09:07:45 2005 +0000
     1.3 @@ -72,7 +72,7 @@ static inline int do_xen_hypercall(int x
     1.4  
     1.5  static inline int do_dom0_op(int xc_handle, dom0_op_t *op)
     1.6  {
     1.7 -    int ret = -1;
     1.8 +    int ret = -1, retries = 0;
     1.9      privcmd_hypercall_t hypercall;
    1.10  
    1.11      op->interface_version = DOM0_INTERFACE_VERSION;
    1.12 @@ -86,8 +86,18 @@ static inline int do_dom0_op(int xc_hand
    1.13          goto out1;
    1.14      }
    1.15  
    1.16 + again:
    1.17      if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
    1.18      {
    1.19 +        if ( (errno == EAGAIN) && (retries++ < 10) )
    1.20 +        {
    1.21 +            /*
    1.22 +             * This was added for memory allocation, where we can get EAGAIN
    1.23 +             * if memory is unavailable because it is on the scrub list.
    1.24 +             */
    1.25 +            sleep(1);
    1.26 +            goto again;
    1.27 +        }
    1.28          if ( errno == EACCES )
    1.29              fprintf(stderr, "Dom0 operation failed -- need to"
    1.30                      " rebuild the user-space tool set?\n");
     2.1 --- a/xen/common/domain.c	Tue Mar 22 19:26:37 2005 +0000
     2.2 +++ b/xen/common/domain.c	Wed Mar 23 09:07:45 2005 +0000
     2.3 @@ -197,7 +197,7 @@ unsigned int alloc_new_dom_mem(struct do
     2.4          if ( unlikely((page = alloc_domheap_page(d)) == NULL) )
     2.5          {
     2.6              domain_relinquish_memory(d);
     2.7 -            return -ENOMEM;
     2.8 +            return list_empty(&page_scrub_list) ? -ENOMEM : -EAGAIN;
     2.9          }
    2.10  
    2.11          /* Initialise the machine-to-phys mapping for this page. */