ia64/xen-unstable

changeset 18390:14a9a1629590

xmalloc: Cannot be called in IRQ context so doesn't need IRQ-safe locking.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Aug 27 10:26:50 2008 +0100 (2008-08-27)
parents 2eefc8294358
children 6c6bda7f09cd
files xen/common/xmalloc.c
line diff
     1.1 --- a/xen/common/xmalloc.c	Wed Aug 27 10:12:49 2008 +0100
     1.2 +++ b/xen/common/xmalloc.c	Wed Aug 27 10:26:50 2008 +0100
     1.3 @@ -136,15 +136,14 @@ static void maybe_split(struct xmalloc_h
     1.4  static void *xmalloc_new_page(size_t size)
     1.5  {
     1.6      struct xmalloc_hdr *hdr;
     1.7 -    unsigned long flags;
     1.8  
     1.9      hdr = alloc_xenheap_page();
    1.10      if ( hdr == NULL )
    1.11          return NULL;
    1.12  
    1.13 -    spin_lock_irqsave(&freelist_lock, flags);
    1.14 +    spin_lock(&freelist_lock);
    1.15      maybe_split(hdr, size, PAGE_SIZE);
    1.16 -    spin_unlock_irqrestore(&freelist_lock, flags);
    1.17 +    spin_unlock(&freelist_lock);
    1.18  
    1.19      return data_from_header(hdr);
    1.20  }
    1.21 @@ -175,7 +174,6 @@ static inline size_t align_up(size_t siz
    1.22  void *_xmalloc(size_t size, size_t align)
    1.23  {
    1.24      struct xmalloc_hdr *i;
    1.25 -    unsigned long flags;
    1.26  
    1.27      ASSERT(!in_irq());
    1.28  
    1.29 @@ -196,17 +194,17 @@ void *_xmalloc(size_t size, size_t align
    1.30          return xmalloc_whole_pages(size);
    1.31  
    1.32      /* Search free list. */
    1.33 -    spin_lock_irqsave(&freelist_lock, flags);
    1.34 +    spin_lock(&freelist_lock);
    1.35      list_for_each_entry( i, &freelist, freelist )
    1.36      {
    1.37          if ( i->size < size )
    1.38              continue;
    1.39          del_from_freelist(i);
    1.40          maybe_split(i, size, i->size);
    1.41 -        spin_unlock_irqrestore(&freelist_lock, flags);
    1.42 +        spin_unlock(&freelist_lock);
    1.43          return data_from_header(i);
    1.44      }
    1.45 -    spin_unlock_irqrestore(&freelist_lock, flags);
    1.46 +    spin_unlock(&freelist_lock);
    1.47  
    1.48      /* Alloc a new page and return from that. */
    1.49      return xmalloc_new_page(size);
    1.50 @@ -214,7 +212,6 @@ void *_xmalloc(size_t size, size_t align
    1.51  
    1.52  void xfree(void *p)
    1.53  {
    1.54 -    unsigned long flags;
    1.55      struct xmalloc_hdr *i, *tmp, *hdr;
    1.56  
    1.57      ASSERT(!in_irq());
    1.58 @@ -238,7 +235,7 @@ void xfree(void *p)
    1.59      }
    1.60  
    1.61      /* Merge with other free block, or put in list. */
    1.62 -    spin_lock_irqsave(&freelist_lock, flags);
    1.63 +    spin_lock(&freelist_lock);
    1.64      list_for_each_entry_safe( i, tmp, &freelist, freelist )
    1.65      {
    1.66          unsigned long _i   = (unsigned long)i;
    1.67 @@ -275,7 +272,7 @@ void xfree(void *p)
    1.68          add_to_freelist(hdr);
    1.69      }
    1.70  
    1.71 -    spin_unlock_irqrestore(&freelist_lock, flags);
    1.72 +    spin_unlock(&freelist_lock);
    1.73  }
    1.74  
    1.75  /*