Lines Matching refs:slab

56 static void arena_dalloc_bin_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab,
58 static void arena_bin_lower_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab,
224 arena_slab_reg_alloc(extent_t *slab, const bin_info_t *bin_info) { in arena_slab_reg_alloc() argument
226 arena_slab_data_t *slab_data = extent_slab_data_get(slab); in arena_slab_reg_alloc()
229 assert(extent_nfree_get(slab) > 0); in arena_slab_reg_alloc()
233 ret = (void *)((uintptr_t)extent_addr_get(slab) + in arena_slab_reg_alloc()
235 extent_nfree_dec(slab); in arena_slab_reg_alloc()
243 arena_slab_regind(extent_t *slab, szind_t binind, const void *ptr) { in arena_slab_regind() argument
247 assert((uintptr_t)ptr >= (uintptr_t)extent_addr_get(slab)); in arena_slab_regind()
248 assert((uintptr_t)ptr < (uintptr_t)extent_past_get(slab)); in arena_slab_regind()
250 assert(((uintptr_t)ptr - (uintptr_t)extent_addr_get(slab)) % in arena_slab_regind()
253 diff = (size_t)((uintptr_t)ptr - (uintptr_t)extent_addr_get(slab)); in arena_slab_regind()
264 arena_slab_reg_dalloc(extent_t *slab, arena_slab_data_t *slab_data, void *ptr) { in arena_slab_reg_dalloc() argument
265 szind_t binind = extent_szind_get(slab); in arena_slab_reg_dalloc()
267 size_t regind = arena_slab_regind(slab, binind, ptr); in arena_slab_reg_dalloc()
269 assert(extent_nfree_get(slab) < bin_info->nregs); in arena_slab_reg_dalloc()
274 extent_nfree_inc(slab); in arena_slab_reg_dalloc()
905 arena_slab_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *slab) { in arena_slab_dalloc() argument
906 arena_nactive_sub(arena, extent_size_get(slab) >> LG_PAGE); in arena_slab_dalloc()
909 arena_extents_dirty_dalloc(tsdn, arena, &extent_hooks, slab); in arena_slab_dalloc()
913 arena_bin_slabs_nonfull_insert(bin_t *bin, extent_t *slab) { in arena_bin_slabs_nonfull_insert() argument
914 assert(extent_nfree_get(slab) > 0); in arena_bin_slabs_nonfull_insert()
915 extent_heap_insert(&bin->slabs_nonfull, slab); in arena_bin_slabs_nonfull_insert()
919 arena_bin_slabs_nonfull_remove(bin_t *bin, extent_t *slab) { in arena_bin_slabs_nonfull_remove() argument
920 extent_heap_remove(&bin->slabs_nonfull, slab); in arena_bin_slabs_nonfull_remove()
925 extent_t *slab = extent_heap_remove_first(&bin->slabs_nonfull); in arena_bin_slabs_nonfull_tryget() local
926 if (slab == NULL) { in arena_bin_slabs_nonfull_tryget()
932 return slab; in arena_bin_slabs_nonfull_tryget()
936 arena_bin_slabs_full_insert(arena_t *arena, bin_t *bin, extent_t *slab) { in arena_bin_slabs_full_insert() argument
937 assert(extent_nfree_get(slab) == 0); in arena_bin_slabs_full_insert()
946 extent_list_append(&bin->slabs_full, slab); in arena_bin_slabs_full_insert()
950 arena_bin_slabs_full_remove(arena_t *arena, bin_t *bin, extent_t *slab) { in arena_bin_slabs_full_remove() argument
954 extent_list_remove(&bin->slabs_full, slab); in arena_bin_slabs_full_remove()
985 (uintptr_t)ptr, true, &alloc_ctx.szind, &alloc_ctx.slab); in arena_reset()
1003 extent_t *slab; in arena_reset() local
1007 slab = bin->slabcur; in arena_reset()
1010 arena_slab_dalloc(tsd_tsdn(tsd), arena, slab); in arena_reset()
1013 while ((slab = extent_heap_remove_first(&bin->slabs_nonfull)) != in arena_reset()
1016 arena_slab_dalloc(tsd_tsdn(tsd), arena, slab); in arena_reset()
1019 for (slab = extent_list_first(&bin->slabs_full); slab != NULL; in arena_reset()
1020 slab = extent_list_first(&bin->slabs_full)) { in arena_reset()
1021 arena_bin_slabs_full_remove(arena, bin, slab); in arena_reset()
1023 arena_slab_dalloc(tsd_tsdn(tsd), arena, slab); in arena_reset()
1095 extent_t *slab; in arena_slab_alloc_hard() local
1103 slab = extent_alloc_wrapper(tsdn, arena, r_extent_hooks, NULL, in arena_slab_alloc_hard()
1106 if (config_stats && slab != NULL) { in arena_slab_alloc_hard()
1111 return slab; in arena_slab_alloc_hard()
1124 extent_t *slab = extents_alloc(tsdn, arena, &extent_hooks, in arena_slab_alloc() local
1127 if (slab == NULL) { in arena_slab_alloc()
1128 slab = extents_alloc(tsdn, arena, &extent_hooks, in arena_slab_alloc()
1132 if (slab == NULL) { in arena_slab_alloc()
1133 slab = arena_slab_alloc_hard(tsdn, arena, &extent_hooks, in arena_slab_alloc()
1135 if (slab == NULL) { in arena_slab_alloc()
1139 assert(extent_slab_get(slab)); in arena_slab_alloc()
1142 arena_slab_data_t *slab_data = extent_slab_data_get(slab); in arena_slab_alloc()
1143 extent_nfree_set(slab, bin_info->nregs); in arena_slab_alloc()
1146 arena_nactive_add(arena, extent_size_get(slab) >> LG_PAGE); in arena_slab_alloc()
1148 return slab; in arena_slab_alloc()
1154 extent_t *slab; in arena_bin_nonfull_slab_get() local
1158 slab = arena_bin_slabs_nonfull_tryget(bin); in arena_bin_nonfull_slab_get()
1159 if (slab != NULL) { in arena_bin_nonfull_slab_get()
1160 return slab; in arena_bin_nonfull_slab_get()
1169 slab = arena_slab_alloc(tsdn, arena, binind, bin_info); in arena_bin_nonfull_slab_get()
1172 if (slab != NULL) { in arena_bin_nonfull_slab_get()
1177 return slab; in arena_bin_nonfull_slab_get()
1185 slab = arena_bin_slabs_nonfull_tryget(bin); in arena_bin_nonfull_slab_get()
1186 if (slab != NULL) { in arena_bin_nonfull_slab_get()
1187 return slab; in arena_bin_nonfull_slab_get()
1198 extent_t *slab; in arena_bin_malloc_hard() local
1205 slab = arena_bin_nonfull_slab_get(tsdn, arena, bin, binind); in arena_bin_malloc_hard()
1214 if (slab != NULL) { in arena_bin_malloc_hard()
1224 if (extent_nfree_get(slab) == bin_info->nregs) { in arena_bin_malloc_hard()
1225 arena_dalloc_bin_slab(tsdn, arena, slab, in arena_bin_malloc_hard()
1228 arena_bin_lower_slab(tsdn, arena, slab, in arena_bin_malloc_hard()
1239 if (slab == NULL) { in arena_bin_malloc_hard()
1242 bin->slabcur = slab; in arena_bin_malloc_hard()
1246 return arena_slab_reg_alloc(slab, bin_info); in arena_bin_malloc_hard()
1264 extent_t *slab; in arena_tcache_fill_small() local
1266 if ((slab = bin->slabcur) != NULL && extent_nfree_get(slab) > in arena_tcache_fill_small()
1268 ptr = arena_slab_reg_alloc(slab, &bin_infos[binind]); in arena_tcache_fill_small()
1325 extent_t *slab; in arena_malloc_small() local
1332 if ((slab = bin->slabcur) != NULL && extent_nfree_get(slab) > 0) { in arena_malloc_small()
1333 ret = arena_slab_reg_alloc(slab, &bin_infos[binind]); in arena_malloc_small()
1469 arena_dissociate_bin_slab(arena_t *arena, extent_t *slab, bin_t *bin) { in arena_dissociate_bin_slab() argument
1471 if (slab == bin->slabcur) { in arena_dissociate_bin_slab()
1474 szind_t binind = extent_szind_get(slab); in arena_dissociate_bin_slab()
1483 arena_bin_slabs_full_remove(arena, bin, slab); in arena_dissociate_bin_slab()
1485 arena_bin_slabs_nonfull_remove(bin, slab); in arena_dissociate_bin_slab()
1491 arena_dalloc_bin_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab, in arena_dalloc_bin_slab() argument
1493 assert(slab != bin->slabcur); in arena_dalloc_bin_slab()
1497 arena_slab_dalloc(tsdn, arena, slab); in arena_dalloc_bin_slab()
1506 arena_bin_lower_slab(UNUSED tsdn_t *tsdn, arena_t *arena, extent_t *slab, in arena_bin_lower_slab() argument
1508 assert(extent_nfree_get(slab) > 0); in arena_bin_lower_slab()
1516 if (bin->slabcur != NULL && extent_snad_comp(bin->slabcur, slab) > 0) { in arena_bin_lower_slab()
1523 bin->slabcur = slab; in arena_bin_lower_slab()
1528 arena_bin_slabs_nonfull_insert(bin, slab); in arena_bin_lower_slab()
1533 arena_dalloc_bin_locked_impl(tsdn_t *tsdn, arena_t *arena, extent_t *slab, in arena_dalloc_bin_locked_impl() argument
1535 arena_slab_data_t *slab_data = extent_slab_data_get(slab); in arena_dalloc_bin_locked_impl()
1536 szind_t binind = extent_szind_get(slab); in arena_dalloc_bin_locked_impl()
1544 arena_slab_reg_dalloc(slab, slab_data, ptr); in arena_dalloc_bin_locked_impl()
1545 unsigned nfree = extent_nfree_get(slab); in arena_dalloc_bin_locked_impl()
1547 arena_dissociate_bin_slab(arena, slab, bin); in arena_dalloc_bin_locked_impl()
1548 arena_dalloc_bin_slab(tsdn, arena, slab, bin); in arena_dalloc_bin_locked_impl()
1549 } else if (nfree == 1 && slab != bin->slabcur) { in arena_dalloc_bin_locked_impl()
1550 arena_bin_slabs_full_remove(arena, bin, slab); in arena_dalloc_bin_locked_impl()
1551 arena_bin_lower_slab(tsdn, arena, slab, bin); in arena_dalloc_bin_locked_impl()