Skip to content

Commit ead453e

Browse files
author
Ralph Castain
authored
Merge pull request #2911 from rhc54/topic/retry
For performance, try to send the oob/tcp message a few times before dropping back into the event library
2 parents e879d29 + b661275 commit ead453e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

orte/mca/oob/tcp/oob_tcp_sendrecv.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
#include "orte/mca/oob/tcp/oob_tcp_common.h"
7676
#include "orte/mca/oob/tcp/oob_tcp_connection.h"
7777

78+
#define OOB_SEND_MAX_RETRIES 3
79+
7880
void mca_oob_tcp_queue_msg(int sd, short args, void *cbdata)
7981
{
8082
mca_oob_tcp_send_t *snd = (mca_oob_tcp_send_t*)cbdata;
@@ -105,7 +107,7 @@ void mca_oob_tcp_queue_msg(int sd, short args, void *cbdata)
105107
static int send_msg(mca_oob_tcp_peer_t* peer, mca_oob_tcp_send_t* msg)
106108
{
107109
struct iovec iov[2];
108-
int iov_count;
110+
int iov_count, retries = 0;
109111
ssize_t remain = msg->sdbytes, rc;
110112

111113
OPAL_TIMING_EVENT((&tm_oob, "to %s %d bytes",
@@ -146,12 +148,20 @@ static int send_msg(mca_oob_tcp_peer_t* peer, mca_oob_tcp_send_t* msg)
146148
* but let the event lib cycle so other messages
147149
* can progress while this socket is busy
148150
*/
151+
++retries;
152+
if (retries < OOB_SEND_MAX_RETRIES) {
153+
goto retry;
154+
}
149155
return ORTE_ERR_RESOURCE_BUSY;
150156
} else if (opal_socket_errno == EWOULDBLOCK) {
151157
/* tell the caller to keep this message on active,
152158
* but let the event lib cycle so other messages
153159
* can progress while this socket is busy
154160
*/
161+
++retries;
162+
if (retries < OOB_SEND_MAX_RETRIES) {
163+
goto retry;
164+
}
155165
return ORTE_ERR_WOULD_BLOCK;
156166
} else {
157167
/* we hit an error and cannot progress this message */

0 commit comments

Comments
 (0)