ia64/xen-unstable

changeset 90:ef4c30e20156

bitkeeper revision 1.15.1.2 (3e2722026ODP1lsB2F7EY-nKjXOFKQ)

try allocating memory several time before failing, then print a /proc/slabinfo style dump
author iap10@labyrinth.cl.cam.ac.uk
date Thu Jan 16 21:20:02 2003 +0000 (2003-01-16)
parents c9c0af497875
children 9ff45074c48b
files xen-2.4.16/common/page_alloc.c
line diff
     1.1 --- a/xen-2.4.16/common/page_alloc.c	Thu Jan 16 15:22:52 2003 +0000
     1.2 +++ b/xen-2.4.16/common/page_alloc.c	Thu Jan 16 21:20:02 2003 +0000
     1.3 @@ -171,11 +171,12 @@ void __init init_page_allocator(unsigned
     1.4  /* Allocate 2^@order contiguous pages. */
     1.5  unsigned long __get_free_pages(int mask, int order)
     1.6  {
     1.7 -    int i;
     1.8 +    int i, attempts = 0;
     1.9      chunk_head_t *alloc_ch, *spare_ch;
    1.10      chunk_tail_t            *spare_ct;
    1.11      unsigned long           flags;
    1.12  
    1.13 +retry:
    1.14      spin_lock_irqsave(&alloc_lock, flags);
    1.15  
    1.16  
    1.17 @@ -185,11 +186,7 @@ unsigned long __get_free_pages(int mask,
    1.18  	    break;
    1.19      }
    1.20  
    1.21 -    if ( i == FREELIST_SIZE )
    1.22 -    {
    1.23 -        printk("Cannot handle page request order %d!\n", order);
    1.24 -	return 0;
    1.25 -    }
    1.26 +    if ( i == FREELIST_SIZE ) goto no_memory;
    1.27   
    1.28      /* Unlink a chunk. */
    1.29      alloc_ch = free_list[i];
    1.30 @@ -220,6 +217,19 @@ unsigned long __get_free_pages(int mask,
    1.31      spin_unlock_irqrestore(&alloc_lock, flags);
    1.32  
    1.33      return((unsigned long)alloc_ch);
    1.34 +
    1.35 + no_memory:
    1.36 +    if ( attempts++ < 8 )
    1.37 +    {
    1.38 +        spin_unlock_irqrestore(&alloc_lock, flags);
    1.39 +        kmem_cache_reap(0);
    1.40 +        goto retry;
    1.41 +    }
    1.42 +
    1.43 +    printk("Cannot handle page request order %d!\n", order);
    1.44 +    dump_slabinfo();
    1.45 +
    1.46 +    return 0;
    1.47  }
    1.48  
    1.49