Lines Matching refs:hole
59 util_vma_foreach_hole_safe(hole, heap) in util_vma_heap_finish()
60 free(hole); in util_vma_heap_finish()
68 util_vma_foreach_hole(hole, heap) { in util_vma_heap_validate()
69 assert(hole->offset > 0); in util_vma_heap_validate()
70 assert(hole->size > 0); in util_vma_heap_validate()
72 if (&hole->link == heap->holes.next) { in util_vma_heap_validate()
76 assert(hole->size + hole->offset == 0 || in util_vma_heap_validate()
77 hole->size + hole->offset > hole->offset); in util_vma_heap_validate()
84 assert(hole->size + hole->offset > hole->offset && in util_vma_heap_validate()
85 hole->size + hole->offset < prev_offset); in util_vma_heap_validate()
87 prev_offset = hole->offset; in util_vma_heap_validate()
95 util_vma_hole_alloc(struct util_vma_hole *hole, in util_vma_hole_alloc() argument
98 assert(hole->offset <= offset); in util_vma_hole_alloc()
99 assert(hole->size >= offset - hole->offset + size); in util_vma_hole_alloc()
101 if (offset == hole->offset && size == hole->size) { in util_vma_hole_alloc()
103 list_del(&hole->link); in util_vma_hole_alloc()
104 free(hole); in util_vma_hole_alloc()
108 assert(offset - hole->offset <= hole->size - size); in util_vma_hole_alloc()
109 uint64_t waste = (hole->size - size) - (offset - hole->offset); in util_vma_hole_alloc()
112 hole->size -= size; in util_vma_hole_alloc()
116 if (offset == hole->offset) { in util_vma_hole_alloc()
118 hole->offset += size; in util_vma_hole_alloc()
119 hole->size -= size; in util_vma_hole_alloc()
126 struct util_vma_hole *high_hole = calloc(1, sizeof(*hole)); in util_vma_hole_alloc()
133 hole->size = offset - hole->offset; in util_vma_hole_alloc()
138 list_addtail(&high_hole->link, &hole->link); in util_vma_hole_alloc()
152 util_vma_foreach_hole_safe(hole, heap) { in util_vma_heap_alloc()
153 if (size > hole->size) in util_vma_heap_alloc()
162 uint64_t offset = (hole->size - size) + hole->offset; in util_vma_heap_alloc()
169 if (offset < hole->offset) in util_vma_heap_alloc()
172 util_vma_hole_alloc(hole, offset, size); in util_vma_heap_alloc()
177 util_vma_foreach_hole_safe_rev(hole, heap) { in util_vma_heap_alloc()
178 if (size > hole->size) in util_vma_heap_alloc()
181 uint64_t offset = hole->offset; in util_vma_heap_alloc()
187 if (pad > hole->size - size) in util_vma_heap_alloc()
193 util_vma_hole_alloc(hole, offset, size); in util_vma_heap_alloc()
221 util_vma_foreach_hole_safe(hole, heap) { in util_vma_heap_alloc_addr()
222 if (hole->offset > offset) in util_vma_heap_alloc_addr()
229 assert(hole->offset <= offset); in util_vma_heap_alloc_addr()
230 if (hole->size < offset - hole->offset + size) in util_vma_heap_alloc_addr()
233 util_vma_hole_alloc(hole, offset, size); in util_vma_heap_alloc_addr()
262 util_vma_foreach_hole(hole, heap) { in util_vma_heap_free()
263 if (hole->offset <= offset) { in util_vma_heap_free()
264 low_hole = hole; in util_vma_heap_free()
267 high_hole = hole; in util_vma_heap_free()
294 struct util_vma_hole *hole = calloc(1, sizeof(*hole)); in util_vma_heap_free() local
296 hole->offset = offset; in util_vma_heap_free()
297 hole->size = size; in util_vma_heap_free()
301 list_add(&hole->link, &high_hole->link); in util_vma_heap_free()
303 list_add(&hole->link, &heap->holes); in util_vma_heap_free()
316 util_vma_foreach_hole(hole, heap) { in util_vma_heap_print()
319 tab, hole->offset, hole->offset, hole->size, hole->size); in util_vma_heap_print()
320 total_free += hole->size; in util_vma_heap_print()