util/vma: Fix util_vma_heap_get_max_free_continuous_size calculation

It was based on misunderstanding of how holes are sorted, they are
sorted by address and not by size.

Fixes: df3ba95a24
("util/vma: Add function to get max continuous free size")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31722>
This commit is contained in:
Danylo Piliaiev
2024-10-17 12:40:33 +02:00
committed by Marge Bot
parent 87cb42f953
commit 3209a97c5c
+5 -4
View File
@@ -355,11 +355,12 @@ util_vma_heap_free(struct util_vma_heap *heap,
uint64_t
util_vma_heap_get_max_free_continuous_size(struct util_vma_heap *heap)
{
if (list_is_empty(&heap->holes))
return 0;
uint64_t max_size = 0;
util_vma_foreach_hole_safe(hole, heap) {
max_size = MAX2(max_size, hole->size);
}
struct util_vma_hole *top_hole = list_first_entry(&heap->holes, struct util_vma_hole, link);
return top_hole->size;
return max_size;
}
void