Skip to content

Commit

Permalink
DAOS-16818 common: Evict NE memory bucket when empty - MD_ON_SSD_p2
Browse files Browse the repository at this point in the history
Address review comment on checking the env variable during pool
open/create and fixed valgrind related failure.

Signed-off-by: Sherin T George <[email protected]>
  • Loading branch information
sherintg committed Nov 29, 2024
1 parent 936bb0c commit 1f2b405
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/common/dav_v2/dav_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dav_uc_callback(int evt_type, void *arg, uint32_t zid)
break;
case UMEM_CACHE_EVENT_PGEVICT:
if (hdl->do_booted) {
VALGRIND_DO_DESTROY_MEMPOOL(z);
VALGRIND_DO_DESTROY_MEMPOOL_COND(z);
}
break;
default:
Expand Down
17 changes: 10 additions & 7 deletions src/common/dav_v2/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,13 @@ heap_mbrt_init(struct palloc_heap *heap)
rt->mb_create_wq = NULL;
rt->mb_pressure = 0;
rt->empty_nemb_cnt = 0;
rt->empty_nemb_gcth = 0;
ret = store->stor_ops->so_waitqueue_create(&rt->mb_create_wq);
rt->empty_nemb_gcth = HEAP_NEMB_EMPTY_THRESHOLD;

d_getenv_uint("DAOS_NEMB_EMPTY_RECYCLE_THRESHOLD", &rt->empty_nemb_gcth);
if (!rt->empty_nemb_gcth)
rt->empty_nemb_gcth = HEAP_NEMB_EMPTY_THRESHOLD;

ret = store->stor_ops->so_waitqueue_create(&rt->mb_create_wq);
if (ret) {
ret = daos_der2errno(ret);
goto error;
Expand Down Expand Up @@ -2293,11 +2298,6 @@ heap_force_recycle(struct palloc_heap *heap)
struct mbrt *mb;
uint32_t zone_id;

if (!heap->rt->empty_nemb_gcth) {
heap->rt->empty_nemb_gcth = HEAP_NEMB_EMPTY_THRESHOLD;
d_getenv_uint("DAOS_NEMB_EMPTY_RECYCLE_THRESHOLD", &heap->rt->empty_nemb_gcth);
}

if (heap->rt->empty_nemb_cnt < heap->rt->empty_nemb_gcth)
return 0;

Expand Down Expand Up @@ -2378,6 +2378,9 @@ heap_vg_open(struct palloc_heap *heap, object_callback cb, void *arg, int object
if (!umem_cache_offisloaded(heap->layout_info.store, GET_ZONE_OFFSET(i)))
continue;

if (!heap_mbrt_ismb_initialized(heap, i))
continue;

if (heap_mbrt_ismb_evictable(heap, i))
VALGRIND_DO_CREATE_MEMPOOL(ZID_TO_ZONE(&heap->layout_info, i), 0, 0);

Expand Down
7 changes: 7 additions & 0 deletions src/common/dav_v2/valgrind_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ extern unsigned _On_memcheck;
VALGRIND_DESTROY_MEMPOOL(heap);\
} while (0)

#define VALGRIND_DO_DESTROY_MEMPOOL_COND(heap) \
do { \
if (On_memcheck) \
if (VALGRIND_MEMPOOL_EXISTS(heap)) \
VALGRIND_DESTROY_MEMPOOL(heap); \
} while (0)

#define VALGRIND_DO_MEMPOOL_ALLOC(heap, addr, size) do {\
if (On_memcheck)\
VALGRIND_MEMPOOL_ALLOC(heap, addr, size);\
Expand Down

0 comments on commit 1f2b405

Please sign in to comment.