/* * heap_recycle_block -- (internal) recycles unused part of the memory block */ static void heap_recycle_block(PMEMobjpool *pop, struct bucket *b, struct memory_block *m, uint32_t units) { if (bucket_is_small(b)) { struct memory_block r = {m->chunk_id, m->zone_id, m->size_idx - units, m->block_off + units }; bucket_insert_block(b, r); } else { heap_resize_chunk(pop, m->chunk_id, m->zone_id, units); } m->size_idx = units; }
/* * heap_recycle_block -- (internal) recycles unused part of the memory block */ static void heap_recycle_block(struct palloc_heap *heap, struct bucket *b, struct memory_block *m, uint32_t units) { if (b->aclass->type == CLASS_RUN) { ASSERT(units <= UINT16_MAX); ASSERT(m->block_off + units <= UINT16_MAX); struct memory_block r = {m->chunk_id, m->zone_id, m->size_idx - units, (uint16_t)(m->block_off + units), 0, 0, NULL, NULL}; memblock_rebuild_state(heap, &r); bucket_insert_block(b, &r); } else { heap_resize_chunk(heap, m->chunk_id, m->zone_id, units); } m->size_idx = units; }
/* * heap_recycle_block -- (internal) recycles unused part of the memory block */ static void heap_recycle_block(PMEMobjpool *pop, struct bucket *b, struct memory_block *m, uint32_t units) { #ifdef _EAP_ALLOC_OPTIMIZE //m->size_idx = units; //return; #endif //printf("bucket_insert_block heap_recycle_block"); if (bucket_is_small(b)) { struct memory_block r = {m->chunk_id, m->zone_id, m->size_idx - units, m->block_off + units}; bucket_insert_block(b, r); } else { heap_resize_chunk(pop, m->chunk_id, m->zone_id, units); } m->size_idx = units; }