Skip to content

Commit a51badd

Browse files
author
Sergey Oblomov
committed
SHADOW ALLOCATOR: minor code optimization
Signed-off-by: Sergey Oblomov <sergeyo@mellanox.com>
1 parent 277c2a9 commit a51badd

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

oshmem/mca/sshmem/ucx/sshmem_ucx.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ void sshmem_ucx_shadow_destroy(sshmem_ucx_shadow_allocator_t *allocator);
5050
int sshmem_ucx_shadow_alloc(sshmem_ucx_shadow_allocator_t *allocator,
5151
unsigned count, unsigned *index);
5252

53-
/* reallocate existing allocated buffer. if possible - used inplace
53+
/* Reallocate existing allocated buffer. If possible - used inplace
5454
* reallocation.
55-
* parameter 'inplace' - out, in case if zero - new buffer was allocated
55+
* Parameter 'inplace' - out, in case if zero - new buffer was allocated
5656
* (inplace is not possible), user should remove original buffer after data
5757
* is copied, else (if inplace == 0) - no additional action required */
5858
int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator,

oshmem/mca/sshmem/ucx/sshmem_ucx_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static unsigned sshmem_ucx_memheap_ptr2index(map_segment_t *s, void *ptr)
336336
return ((char*)ptr - (char*)s->super.va_base) / ALLOC_ELEM_SIZE;
337337
}
338338

339-
void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size)
339+
static void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size)
340340
{
341341
const size_t count = (size + sizeof(uint64_t) - 1) / sizeof(uint64_t);
342342
uint64_t *dst64 = (uint64_t*)dst;

oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator,
128128
return OSHMEM_SUCCESS;
129129
}
130130

131-
if (count < elem->block_size) {
131+
if (count < old_count) {
132132
/* requested block is shorter than allocated block
133133
* then just cut current buffer */
134134
sshmem_ucx_shadow_set_elem(elem + count,

0 commit comments

Comments
 (0)