@@ -840,7 +840,6 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in
840840 OBJ_CONSTRUCT (& module -> pending_posts , opal_list_t );
841841 module -> start_grp_ranks = NULL ;
842842 module -> lock_all_is_nocheck = false;
843- module -> acc_lock_refcnt = 0 ;
844843
845844 if (!module -> no_locks ) {
846845 OBJ_CONSTRUCT (& module -> outstanding_locks , opal_hash_table_t );
@@ -931,26 +930,23 @@ inline int ompi_osc_ucx_state_lock(
931930 int ret = OMPI_SUCCESS ;
932931
933932 if (force_lock || ompi_osc_need_acc_lock (module , target )) {
934- if (module -> acc_lock_refcnt == 0 ) {
935- for (;;) {
936- ret = opal_common_ucx_wpmem_cmpswp (module -> state_mem ,
937- TARGET_LOCK_UNLOCKED , TARGET_LOCK_EXCLUSIVE ,
938- target , & result_value , sizeof (result_value ),
939- remote_addr , ep );
940- if (ret != OMPI_SUCCESS ) {
941- OSC_UCX_VERBOSE (1 , "opal_common_ucx_mem_cmpswp failed: %d" , ret );
942- return OMPI_ERROR ;
943- }
944- if (result_value == TARGET_LOCK_UNLOCKED ) {
945- break ;
946- }
947-
948- opal_common_ucx_wpool_progress (mca_osc_ucx_component .wpool );
933+ for (;;) {
934+ ret = opal_common_ucx_wpmem_cmpswp (module -> state_mem ,
935+ TARGET_LOCK_UNLOCKED , TARGET_LOCK_EXCLUSIVE ,
936+ target , & result_value , sizeof (result_value ),
937+ remote_addr , ep );
938+ if (ret != OMPI_SUCCESS ) {
939+ OSC_UCX_VERBOSE (1 , "opal_common_ucx_mem_cmpswp failed: %d" , ret );
940+ return OMPI_ERROR ;
949941 }
942+ if (result_value == TARGET_LOCK_UNLOCKED ) {
943+ break ;
944+ }
945+
946+ opal_common_ucx_wpool_progress (mca_osc_ucx_component .wpool );
950947 }
951948
952949 * lock_acquired = true;
953- module -> acc_lock_refcnt ++ ;
954950 } else {
955951 * lock_acquired = false;
956952 }
@@ -977,15 +973,11 @@ inline int ompi_osc_ucx_state_unlock(
977973 return OMPI_ERROR ;
978974 }
979975
980- if (module -> acc_lock_refcnt == 1 ) {
981- ret = opal_common_ucx_wpmem_fetch (module -> state_mem ,
982- UCP_ATOMIC_FETCH_OP_SWAP , TARGET_LOCK_UNLOCKED ,
983- target , & result_value , sizeof (result_value ),
984- remote_addr , ep );
985- assert (result_value == TARGET_LOCK_EXCLUSIVE );
986- }
987- module -> acc_lock_refcnt -- ;
988- assert (module -> acc_lock_refcnt >= 0 );
976+ ret = opal_common_ucx_wpmem_fetch (module -> state_mem ,
977+ UCP_ATOMIC_FETCH_OP_SWAP , TARGET_LOCK_UNLOCKED ,
978+ target , & result_value , sizeof (result_value ),
979+ remote_addr , ep );
980+ assert (result_value == TARGET_LOCK_EXCLUSIVE );
989981 } else if (NULL != free_ptr ){
990982 /* flush before freeing the buffer */
991983 ret = opal_common_ucx_ctx_flush (module -> ctx , OPAL_COMMON_UCX_SCOPE_EP , target );
0 commit comments