Lines Matching refs:theheap
53 static struct heap theheap; variable
76 dprintf(INFO, "\tbase %p, len 0x%zx\n", theheap.base, theheap.len); in miniheap_dump()
79 mutex_acquire(&theheap.lock); in miniheap_dump()
82 list_for_every_entry(&theheap.free_list, chunk, struct free_heap_chunk, node) { in miniheap_dump()
85 mutex_release(&theheap.lock); in miniheap_dump()
99 mutex_acquire(&theheap.lock); in heap_insert_free_chunk()
101 theheap.remaining += chunk->len; in heap_insert_free_chunk()
104 list_for_every_entry(&theheap.free_list, next_chunk, struct free_heap_chunk, node) { in heap_insert_free_chunk()
115 list_add_tail(&theheap.free_list, &chunk->node); in heap_insert_free_chunk()
119 last_chunk = list_prev_type(&theheap.free_list, &chunk->node, struct free_heap_chunk, node); in heap_insert_free_chunk()
145 mutex_release(&theheap.lock); in heap_insert_free_chunk()
203 mutex_acquire(&theheap.lock); in miniheap_alloc()
208 list_for_every_entry(&theheap.free_list, chunk, struct free_heap_chunk, node) { in miniheap_alloc()
216 struct list_node *next_node = list_next(&theheap.free_list, &chunk->node); in miniheap_alloc()
230 list_add_tail(&theheap.free_list, &newchunk->node); in miniheap_alloc()
255 theheap.remaining -= size; in miniheap_alloc()
257 if (theheap.remaining < theheap.low_watermark) { in miniheap_alloc()
258 theheap.low_watermark = theheap.remaining; in miniheap_alloc()
272 mutex_release(&theheap.lock); in miniheap_alloc()
348 mutex_acquire(&theheap.lock); in miniheap_trim()
353 list_for_every_entry_safe(&theheap.free_list, chunk, next_chunk, struct free_heap_chunk, node) { in miniheap_trim()
430 theheap.remaining -= end_page - start_page; in miniheap_trim()
434 mutex_release(&theheap.lock); in miniheap_trim()
440 ptr->heap_start = theheap.base; in miniheap_get_stats()
441 ptr->heap_len = theheap.len; in miniheap_get_stats()
445 mutex_acquire(&theheap.lock); in miniheap_get_stats()
447 list_for_every_entry(&theheap.free_list, chunk, struct free_heap_chunk, node) { in miniheap_get_stats()
455 ptr->heap_low_watermark = theheap.low_watermark; in miniheap_get_stats()
457 mutex_release(&theheap.lock); in miniheap_get_stats()
473 if ((uintptr_t)ptr < (uintptr_t)theheap.base || theheap.base == 0) in heap_grow()
474 theheap.base = ptr; in heap_grow()
477 if (endptr > (uintptr_t)theheap.base + theheap.len) { in heap_grow()
478 theheap.len = (uintptr_t)endptr - (uintptr_t)theheap.base; in heap_grow()
488 mutex_init(&theheap.lock); in miniheap_init()
491 list_initialize(&theheap.free_list); in miniheap_init()
506 theheap.base = ptr; in miniheap_init()
507 theheap.len = len; in miniheap_init()
508 theheap.remaining = 0; // will get set by heap_insert_free_chunk() in miniheap_init()
509 theheap.low_watermark = 0; in miniheap_init()