[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xmalloc: Cannot be called in IRQ context so doesn't need IRQ-safe locking.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1219829210 -3600 # Node ID 14a9a1629590242713198a043cec22266e4228eb # Parent 2eefc8294358164a7a3f7323716a1c7ccb3c2508 xmalloc: Cannot be called in IRQ context so doesn't need IRQ-safe locking. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/common/xmalloc.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) diff -r 2eefc8294358 -r 14a9a1629590 xen/common/xmalloc.c --- a/xen/common/xmalloc.c Wed Aug 27 10:12:49 2008 +0100 +++ b/xen/common/xmalloc.c Wed Aug 27 10:26:50 2008 +0100 @@ -136,15 +136,14 @@ static void *xmalloc_new_page(size_t siz static void *xmalloc_new_page(size_t size) { struct xmalloc_hdr *hdr; - unsigned long flags; hdr = alloc_xenheap_page(); if ( hdr == NULL ) return NULL; - spin_lock_irqsave(&freelist_lock, flags); + spin_lock(&freelist_lock); maybe_split(hdr, size, PAGE_SIZE); - spin_unlock_irqrestore(&freelist_lock, flags); + spin_unlock(&freelist_lock); return data_from_header(hdr); } @@ -175,7 +174,6 @@ void *_xmalloc(size_t size, size_t align void *_xmalloc(size_t size, size_t align) { struct xmalloc_hdr *i; - unsigned long flags; ASSERT(!in_irq()); @@ -196,17 +194,17 @@ void *_xmalloc(size_t size, size_t align return xmalloc_whole_pages(size); /* Search free list. */ - spin_lock_irqsave(&freelist_lock, flags); + spin_lock(&freelist_lock); list_for_each_entry( i, &freelist, freelist ) { if ( i->size < size ) continue; del_from_freelist(i); maybe_split(i, size, i->size); - spin_unlock_irqrestore(&freelist_lock, flags); + spin_unlock(&freelist_lock); return data_from_header(i); } - spin_unlock_irqrestore(&freelist_lock, flags); + spin_unlock(&freelist_lock); /* Alloc a new page and return from that. */ return xmalloc_new_page(size); @@ -214,7 +212,6 @@ void *_xmalloc(size_t size, size_t align void xfree(void *p) { - unsigned long flags; struct xmalloc_hdr *i, *tmp, *hdr; ASSERT(!in_irq()); @@ -238,7 +235,7 @@ void xfree(void *p) } /* Merge with other free block, or put in list. */ - spin_lock_irqsave(&freelist_lock, flags); + spin_lock(&freelist_lock); list_for_each_entry_safe( i, tmp, &freelist, freelist ) { unsigned long _i = (unsigned long)i; @@ -275,7 +272,7 @@ void xfree(void *p) add_to_freelist(hdr); } - spin_unlock_irqrestore(&freelist_lock, flags); + spin_unlock(&freelist_lock); } /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |