mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
initial no more pairmap
This commit is contained in:
parent
7443ee317e
commit
ec9c61c066
5 changed files with 465 additions and 711 deletions
|
@ -700,7 +700,9 @@ static inline bool mi_page_try_claim_ownership(mi_page_t* page) {
|
|||
return ((old&1)==0);
|
||||
}
|
||||
|
||||
static inline void _mi_page_unown(mi_page_t* page) {
|
||||
// release ownership of a page. This may free the page if all blocks were concurrently
|
||||
// freed in the meantime. Returns true if the page was freed.
|
||||
static inline bool _mi_page_unown(mi_page_t* page) {
|
||||
mi_assert_internal(mi_page_is_owned(page));
|
||||
mi_assert_internal(mi_page_is_abandoned(page));
|
||||
mi_thread_free_t tf_new;
|
||||
|
@ -712,13 +714,14 @@ static inline void _mi_page_unown(mi_page_t* page) {
|
|||
if (mi_page_all_free(page)) { // it may become free just before unowning it
|
||||
_mi_arena_page_unabandon(page);
|
||||
_mi_arena_page_free(page);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
tf_old = mi_atomic_load_relaxed(&page->xthread_free);
|
||||
}
|
||||
mi_assert_internal(mi_tf_block(tf_old)==NULL);
|
||||
tf_new = mi_tf_create(NULL, false);
|
||||
} while (!mi_atomic_cas_weak_release(&page->xthread_free, &tf_old, tf_new));
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
|
|
@ -117,16 +117,16 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
#define MI_ARENA_SLICE_SHIFT (13 + MI_SIZE_SHIFT) // 64 KiB (32 KiB on 32-bit)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MI_BITMAP_CHUNK_BITS_SHIFT
|
||||
#define MI_BITMAP_CHUNK_BITS_SHIFT (6 + MI_SIZE_SHIFT) // optimized for 512 bits per chunk (avx512)
|
||||
#ifndef MI_BCHUNK_BITS_SHIFT
|
||||
#define MI_BCHUNK_BITS_SHIFT (6 + MI_SIZE_SHIFT) // optimized for 512 bits per chunk (avx512)
|
||||
#endif
|
||||
|
||||
#define MI_BITMAP_CHUNK_BITS (1 << MI_BITMAP_CHUNK_BITS_SHIFT)
|
||||
#define MI_BCHUNK_BITS (1 << MI_BCHUNK_BITS_SHIFT)
|
||||
#define MI_ARENA_SLICE_SIZE (MI_ZU(1) << MI_ARENA_SLICE_SHIFT)
|
||||
#define MI_ARENA_SLICE_ALIGN (MI_ARENA_SLICE_SIZE)
|
||||
|
||||
#define MI_ARENA_MIN_OBJ_SLICES (1)
|
||||
#define MI_ARENA_MAX_OBJ_SLICES (MI_BITMAP_CHUNK_BITS) // 32 MiB (for now, cannot cross chunk boundaries)
|
||||
#define MI_ARENA_MAX_OBJ_SLICES (MI_BCHUNK_BITS) // 32 MiB (for now, cannot cross chunk boundaries)
|
||||
|
||||
#define MI_ARENA_MIN_OBJ_SIZE (MI_ARENA_MIN_OBJ_SLICES * MI_ARENA_SLICE_SIZE)
|
||||
#define MI_ARENA_MAX_OBJ_SIZE (MI_ARENA_MAX_OBJ_SLICES * MI_ARENA_SLICE_SIZE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue