@@ -305,20 +305,6 @@ opal_common_ucx_wpool_progress(opal_common_ucx_wpool_t *wpool)
305
305
return completed ;
306
306
}
307
307
308
- // static int
309
- // _wpool_list_return_item(opal_common_ucx_wpool_t *wpool, opal_list_t *idle_list, opal_list_t *active_list,
310
- // opal_common_ucx_winfo_t *winfo)
311
- // {
312
- // opal_list_item_t *tmp = NULL;
313
- // opal_mutex_lock(&wpool->mutex);
314
- // tmp = opal_list_remove_item(active_list, &(winfo->self->super));
315
- // assert(NULL != tmp);
316
- // opal_list_append(idle_list, &(winfo->self->super));
317
- // opal_mutex_unlock(&wpool->mutex);
318
- //
319
- // return OPAL_SUCCESS;
320
- // }
321
-
322
308
static int
323
309
_wpool_list_put (opal_common_ucx_wpool_t * wpool , opal_list_t * list ,
324
310
opal_common_ucx_winfo_t * winfo )
@@ -358,15 +344,6 @@ _wpool_list_get(opal_common_ucx_wpool_t *wpool, opal_list_t *list)
358
344
OBJ_RELEASE (item );
359
345
}
360
346
return winfo ;
361
-
362
- /*XXX*/
363
- // opal_mutex_lock(&wpool->mutex);
364
- // _winfo_list_item_t *item = (_winfo_list_item_t *)opal_list_remove_first(list);
365
- // opal_mutex_unlock(&wpool->mutex);
366
- // winfo = item->ptr;
367
- // OBJ_DESTRUCT(item);
368
- //
369
- // return winfo;
370
347
}
371
348
372
349
static opal_common_ucx_winfo_t *
@@ -407,7 +384,7 @@ opal_common_ucx_wpctx_create(opal_common_ucx_wpool_t *wpool, int comm_size,
407
384
opal_common_ucx_ctx_t * ctx = calloc (1 , sizeof (* ctx ));
408
385
int ret = OPAL_SUCCESS ;
409
386
410
- OBJ_CONSTRUCT (& ctx -> mutex , opal_recursive_mutex_t );
387
+ OBJ_CONSTRUCT (& ctx -> mutex , opal_mutex_t );
411
388
OBJ_CONSTRUCT (& ctx -> ctx_records , opal_list_t );
412
389
413
390
ctx -> wpool = wpool ;
@@ -492,6 +469,7 @@ int opal_common_ucx_wpmem_create(opal_common_ucx_ctx_t *ctx,
492
469
mem -> mem_addrs = NULL ;
493
470
mem -> mem_displs = NULL ;
494
471
472
+ OBJ_CONSTRUCT (& mem -> mutex , opal_mutex_t );
495
473
OBJ_CONSTRUCT (& mem -> mem_records , opal_list_t );
496
474
497
475
ret = _comm_ucx_wpmem_map (ctx -> wpool , mem_base , mem_size , & mem -> memh ,
@@ -639,7 +617,9 @@ _tlocal_ctx_rec_cleanup(_ctx_record_t *ctx_rec)
639
617
* Remove the context record from the ctx list */
640
618
opal_list_remove_item (& wpool -> active_workers , & winfo -> self -> super );
641
619
opal_list_prepend (& wpool -> idle_workers , & winfo -> self -> super );
620
+ opal_mutex_lock (& ctx_rec -> gctx -> mutex );
642
621
opal_list_remove_item (& ctx_rec -> gctx -> ctx_records , & ctx_rec -> super );
622
+ opal_mutex_unlock (& ctx_rec -> gctx -> mutex );
643
623
644
624
opal_mutex_unlock (& wpool -> mutex );
645
625
@@ -705,6 +685,7 @@ static int _tlocal_ctx_connect(_ctx_record_t *ctx_rec, int target)
705
685
if (status != UCS_OK ) {
706
686
opal_mutex_unlock (& winfo -> mutex );
707
687
MCA_COMMON_UCX_VERBOSE (1 , "ucp_ep_create failed: %d" , status );
688
+ opal_mutex_unlock (& winfo -> mutex );
708
689
return OPAL_ERROR ;
709
690
}
710
691
opal_mutex_unlock (& winfo -> mutex );
@@ -733,9 +714,9 @@ _tlocal_mem_rec_cleanup(_mem_record_t *mem_rec)
733
714
free (mem_rec -> rkeys );
734
715
735
716
/* Remove item from the list */
736
- opal_mutex_lock (& mem_rec -> gmem -> ctx -> mutex );
717
+ opal_mutex_lock (& mem_rec -> gmem -> mutex );
737
718
opal_list_remove_item (& mem_rec -> gmem -> mem_records , & mem_rec -> super );
738
- opal_mutex_unlock (& mem_rec -> gmem -> ctx -> mutex );
719
+ opal_mutex_unlock (& mem_rec -> gmem -> mutex );
739
720
740
721
OBJ_RELEASE (mem_rec );
741
722
@@ -750,9 +731,9 @@ static _mem_record_t *_tlocal_add_mem_rec(opal_common_ucx_wpmem_t *mem, _ctx_rec
750
731
return NULL ;
751
732
}
752
733
753
- opal_mutex_lock (& ctx_rec -> gctx -> mutex );
734
+ opal_mutex_lock (& mem -> mutex );
754
735
opal_list_append (& mem -> mem_records , & mem_rec -> super );
755
- opal_mutex_unlock (& ctx_rec -> gctx -> mutex );
736
+ opal_mutex_unlock (& mem -> mutex );
756
737
757
738
758
739
mem_rec -> gmem = mem ;
@@ -777,8 +758,10 @@ _tlocal_mem_create_rkey(_mem_record_t *mem_rec, ucp_ep_h ep, int target)
777
758
int displ = gmem -> mem_displs [target ];
778
759
ucs_status_t status ;
779
760
761
+ opal_mutex_lock (& mem_rec -> winfo -> mutex );
780
762
status = ucp_ep_rkey_unpack (ep , & gmem -> mem_addrs [displ ],
781
763
& mem_rec -> rkeys [target ]);
764
+ opal_mutex_unlock (& mem_rec -> winfo -> mutex );
782
765
if (status != UCS_OK ) {
783
766
MCA_COMMON_UCX_VERBOSE (1 , "ucp_ep_rkey_unpack failed: %d" , status );
784
767
return OPAL_ERROR ;
@@ -890,9 +873,9 @@ opal_common_ucx_wpmem_flush(opal_common_ucx_wpmem_t *mem,
890
873
(NULL == winfo -> endpoints [target ])) {
891
874
continue ;
892
875
}
893
- opal_mutex_lock (& winfo -> mutex );
894
876
rc = opal_common_ucx_winfo_flush (winfo , target , OPAL_COMMON_UCX_FLUSH_B ,
895
877
scope , NULL );
878
+ opal_mutex_lock (& winfo -> mutex );
896
879
switch (scope ) {
897
880
case OPAL_COMMON_UCX_SCOPE_WORKER :
898
881
winfo -> global_inflight_ops = 0 ;
0 commit comments