[haiku-commits] r35424 - haiku/trunk/src/system/libroot/posix/malloc_debug

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 7 Feb 2010 03:02:13 +0100 (CET)

Author: mmlr
Date: 2010-02-07 03:02:13 +0100 (Sun, 07 Feb 2010)
New Revision: 35424
Changeset: http://dev.haiku-os.org/changeset/35424/haiku

Modified:
   haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp
Log:
Sync two locking changes from kernel heap. This just moves the page locking into
the contiguous page allocation function and unlocks a bin locker a bit earlier.


Modified: haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp
===================================================================
--- haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp  2010-02-07 
01:59:53 UTC (rev 35423)
+++ haiku/trunk/src/system/libroot/posix/malloc_debug/heap.cpp  2010-02-07 
02:02:13 UTC (rev 35424)
@@ -919,6 +919,7 @@
 heap_allocate_contiguous_pages(heap_allocator *heap, uint32 pageCount,
        size_t alignment)
 {
+       MutexLocker pageLocker(heap->page_lock);
        heap_area *area = heap->areas;
        while (area) {
                if (area->free_page_count < pageCount) {
@@ -1000,7 +1001,6 @@
        INFO(("heap %p: allocate %lu bytes from raw pages with alignment %lu\n",
                heap, size, alignment));
 
-       MutexLocker pageLocker(heap->page_lock);
        uint32 pageCount = (size + heap->page_size - 1) / heap->page_size;
        heap_page *firstPage = heap_allocate_contiguous_pages(heap, pageCount,
                alignment);
@@ -1079,6 +1079,7 @@
                page->next = page->prev = NULL;
        }
 
+       binLocker.Unlock();
        heap_add_leak_check_info((addr_t)address, bin->element_size, size);
        return address;
 }


Other related posts:

  • » [haiku-commits] r35424 - haiku/trunk/src/system/libroot/posix/malloc_debug - mmlr