@@ -251,7 +251,7 @@ struct efa_ah *efa_ah_alloc(struct efa_domain *domain, const uint8_t *gid)
251
251
return efa_ah ;
252
252
}
253
253
254
- efa_ah = malloc ( sizeof (struct efa_ah ));
254
+ ofi_memalign (( void * * ) & efa_ah , EFA_MEM_ALIGNMENT , sizeof (struct efa_ah ));
255
255
if (!efa_ah ) {
256
256
errno = FI_ENOMEM ;
257
257
EFA_WARN (FI_LOG_AV , "cannot allocate memory for efa_ah\n" );
@@ -469,7 +469,7 @@ int efa_av_reverse_av_add(struct efa_av *av,
469
469
470
470
HASH_FIND (hh , * cur_reverse_av , & cur_key , sizeof (cur_key ), cur_entry );
471
471
if (!cur_entry ) {
472
- cur_entry = malloc ( sizeof (* cur_entry ));
472
+ ofi_memalign (( void * * ) & cur_entry , EFA_MEM_ALIGNMENT , sizeof (* cur_entry ));
473
473
if (!cur_entry ) {
474
474
EFA_WARN (FI_LOG_AV , "Cannot allocate memory for cur_reverse_av entry\n" );
475
475
return - FI_ENOMEM ;
@@ -487,7 +487,7 @@ int efa_av_reverse_av_add(struct efa_av *av,
487
487
* and only RDM endpoint can reach here. hence the following assertion
488
488
*/
489
489
assert (av -> domain -> info_type == EFA_INFO_RDM );
490
- prv_entry = malloc ( sizeof (* prv_entry ));
490
+ ofi_memalign (( void * * ) & prv_entry , 64 , sizeof (* prv_entry ));
491
491
if (!prv_entry ) {
492
492
EFA_WARN (FI_LOG_AV , "Cannot allocate memory for prv_reverse_av entry\n" );
493
493
return - FI_ENOMEM ;
@@ -1315,9 +1315,10 @@ int efa_av_open(struct fid_domain *domain_fid, struct fi_av_attr *attr,
1315
1315
else
1316
1316
attr -> count = MAX (attr -> count , EFA_MIN_AV_SIZE );
1317
1317
1318
- av = calloc ( 1 , sizeof (* av ));
1318
+ ofi_memalign (( void * * ) & av , EFA_MEM_ALIGNMENT , sizeof (* av ));
1319
1319
if (!av )
1320
1320
return - FI_ENOMEM ;
1321
+ memset (av , 0x0 , sizeof (* av ));
1321
1322
1322
1323
if (attr -> type == FI_AV_MAP ) {
1323
1324
EFA_INFO (FI_LOG_AV , "FI_AV_MAP is deprecated in Libfabric 2.x. Please use FI_AV_TABLE. "
0 commit comments