-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Context
mimalloc v2.2.4+ added automatic collection of freed pages every generic_collect operations which is great.
Unfortunately, it greatly affects p99.9/max latency of allocations even for a stable workload.
Detailed analysis
mi_heap_collect_ex calls mi_heap_visit_pages(heap, &mi_heap_page_collect, &collect, NULL); which goes over ALL page queues including MI_BIN_FULL. Consider a "happy" situation where we allocated 30GB of memory on a heap and most of its pages are full. MI_BIN_FULL will consists of dozens of thousands of pages that will be traversed upon each invocation of mi_heap_visit_pages and to my mind absolutely for nothing - by definition of MI_BIN_FULL queue.
Suggestion
Add max_queue_id argument to mi_heap_visit_pages that will limit the traversal of page queues.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels