SHADOW ALLOCATOR: minor code optimization
Signed-off-by: Sergey Oblomov <sergeyo@mellanox.com>
Этот коммит содержится в:
родитель
277c2a9e5c
Коммит
a51badd627
@ -50,9 +50,9 @@ void sshmem_ucx_shadow_destroy(sshmem_ucx_shadow_allocator_t *allocator);
|
||||
int sshmem_ucx_shadow_alloc(sshmem_ucx_shadow_allocator_t *allocator,
|
||||
unsigned count, unsigned *index);
|
||||
|
||||
/* reallocate existing allocated buffer. if possible - used inplace
|
||||
/* Reallocate existing allocated buffer. If possible - used inplace
|
||||
* reallocation.
|
||||
* parameter 'inplace' - out, in case if zero - new buffer was allocated
|
||||
* Parameter 'inplace' - out, in case if zero - new buffer was allocated
|
||||
* (inplace is not possible), user should remove original buffer after data
|
||||
* is copied, else (if inplace == 0) - no additional action required */
|
||||
int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator,
|
||||
|
@ -336,7 +336,7 @@ static unsigned sshmem_ucx_memheap_ptr2index(map_segment_t *s, void *ptr)
|
||||
return ((char*)ptr - (char*)s->super.va_base) / ALLOC_ELEM_SIZE;
|
||||
}
|
||||
|
||||
void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size)
|
||||
static void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size)
|
||||
{
|
||||
const size_t count = (size + sizeof(uint64_t) - 1) / sizeof(uint64_t);
|
||||
uint64_t *dst64 = (uint64_t*)dst;
|
||||
|
@ -128,7 +128,7 @@ int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator,
|
||||
return OSHMEM_SUCCESS;
|
||||
}
|
||||
|
||||
if (count < elem->block_size) {
|
||||
if (count < old_count) {
|
||||
/* requested block is shorter than allocated block
|
||||
* then just cut current buffer */
|
||||
sshmem_ucx_shadow_set_elem(elem + count,
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user