mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-24 00:04:48 +03:00
enable segment binning
This commit is contained in:
parent
fab7397e6b
commit
f7df2c0680
5 changed files with 84 additions and 34 deletions
|
@ -380,6 +380,7 @@ typedef enum mi_option_e {
|
|||
mi_option_guarded_sample_rate, // 1 out of N allocations in the min/max range will be guarded (=1000)
|
||||
mi_option_guarded_sample_seed, // can be set to allow for a (more) deterministic re-execution when a guard page is triggered (=0)
|
||||
mi_option_target_segments_per_thread, // experimental (=0)
|
||||
mi_option_segment_binning, // use size bins for segments to reduce fragmentation in large workloads
|
||||
_mi_option_last,
|
||||
// legacy option names
|
||||
mi_option_large_os_pages = mi_option_allow_large_os_pages,
|
||||
|
|
|
@ -366,8 +366,13 @@ typedef enum mi_page_kind_e {
|
|||
// used for blocks `> MI_LARGE_OBJ_SIZE_MAX` or an aligment `> MI_BLOCK_ALIGNMENT_MAX`.
|
||||
} mi_page_kind_t;
|
||||
|
||||
// We bin the segments as well to reduce fragmentation over the long run
|
||||
// where some small pages can prevent a large page from fitting
|
||||
// (note: this currently matches the pages but this does not have to be (so it's its own separate type))
|
||||
typedef enum mi_segment_kind_e {
|
||||
MI_SEGMENT_NORMAL, // MI_SEGMENT_SIZE size with pages inside.
|
||||
MI_SEGMENT_SMALL, // for small pages and up
|
||||
MI_SEGMENT_MEDIUM, // for medium pages and up
|
||||
MI_SEGMENT_LARGE, // for large pages and up
|
||||
MI_SEGMENT_HUGE, // segment with just one huge page inside.
|
||||
} mi_segment_kind_t;
|
||||
|
||||
|
@ -728,7 +733,7 @@ typedef struct mi_span_queue_s {
|
|||
|
||||
// Segments thread local data
|
||||
typedef struct mi_segments_tld_s {
|
||||
mi_span_queue_t spans[MI_SEGMENT_BIN_MAX+1]; // free slice spans inside segments
|
||||
mi_span_queue_t spans[MI_SEGMENT_HUGE][MI_SEGMENT_BIN_MAX+1]; // free slice spans inside segments per segment_kind up to (but not including) MI_SEGMENT_HUGE.
|
||||
size_t count; // current number of segments;
|
||||
size_t peak_count; // peak number of segments
|
||||
size_t current_size; // current size of all segments
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue