diff --git a/src/mpid/ch4/shm/posix/posix_init.c b/src/mpid/ch4/shm/posix/posix_init.c index 16877a8cb94..5fba5f8c78f 100644 --- a/src/mpid/ch4/shm/posix/posix_init.c +++ b/src/mpid/ch4/shm/posix/posix_init.c @@ -47,6 +47,28 @@ description : >- Controls topology-aware communication in POSIX. + - name : MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_RECV_LOOPS + category : CH4 + type : int + default : 1 + class : none + verbosity : MPI_T_VERBOSITY_USER_BASIC + scope : MPI_T_SCOPE_ALL_EQ + description : >- + Controls the maximum number of polling on recv queue + per progress. + + - name : MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_SEND_LOOPS + category : CH4 + type : int + default : 1 + class : none + verbosity : MPI_T_VERBOSITY_USER_BASIC + scope : MPI_T_SCOPE_ALL_EQ + description : >- + Controls the maximum number of polling on send queue (for + deferred sends) per progress. + === END_MPI_T_CVAR_INFO_BLOCK === */ diff --git a/src/mpid/ch4/shm/posix/posix_progress.h b/src/mpid/ch4/shm/posix/posix_progress.h index e9832f3cf51..1ebb61335e6 100644 --- a/src/mpid/ch4/shm/posix/posix_progress.h +++ b/src/mpid/ch4/shm/posix/posix_progress.h @@ -144,11 +144,25 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_progress(int vci, int *made_progress) MPIR_Assert(vci < MPIDI_POSIX_global.num_vcis); - mpi_errno = MPIDI_POSIX_progress_recv(vci, made_progress); - MPIR_ERR_CHECK(mpi_errno); + for (int i = 0; i < MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_RECV_LOOPS; i++) { + int made_recv_progress = 0; + mpi_errno = MPIDI_POSIX_progress_recv(vci, &made_recv_progress); + MPIR_ERR_CHECK(mpi_errno); + if (!made_recv_progress) + break; + + *made_progress |= made_recv_progress; + } + + for (int i = 0; i < MPIR_CVAR_CH4_SHM_POSIX_PROGRESS_SEND_LOOPS; i++) { + int made_send_progress = 0; + mpi_errno = MPIDI_POSIX_progress_send(vci, &made_send_progress); + MPIR_ERR_CHECK(mpi_errno); + if (!made_send_progress) + break; - mpi_errno = MPIDI_POSIX_progress_send(vci, made_progress); - MPIR_ERR_CHECK(mpi_errno); + *made_progress |= made_send_progress; + } fn_exit: MPIR_FUNC_EXIT;