Skip to content

Commit ba28c17

Browse files
committed
Only set in_progress around code that directly executes continuations
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
1 parent ca34edc commit ba28c17

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ompi/mpiext/continue/c/continuation.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ void ompi_continue_cont_release(ompi_continuation_t *cont, int rc)
261261
opal_atomic_wmb();
262262
/* signal that all continuations were found complete */
263263
ompi_request_complete(&cont_req->super, true);
264-
cont_req->super.req_state = OMPI_REQUEST_INACTIVE;
265264
}
266265

267266
OBJ_RELEASE(cont_req);
@@ -300,7 +299,7 @@ int ompi_continue_progress_n(const uint32_t max, thread_local_data_t *tld)
300299
if (tld->in_progress) return 0;
301300

302301
uint32_t completed = 0;
303-
tld->in_progress = 1;
302+
304303

305304
const bool using_threads = opal_using_threads();
306305

@@ -314,6 +313,7 @@ int ompi_continue_progress_n(const uint32_t max, thread_local_data_t *tld)
314313
}
315314
}
316315

316+
tld->in_progress = 1;
317317
if (!opal_list_is_empty(&continuation_list)) {
318318
/* global progress */
319319
//TODO: steal some requests and process them in chunks to reduce locking?
@@ -353,6 +353,7 @@ static int ompi_continue_wait_progress_callback()
353353
static inline
354354
int ompi_continue_progress_request_n(ompi_cont_request_t *cont_req, uint32_t max_poll, thread_local_data_t *tld)
355355
{
356+
if (tld->in_progress) return 0;
356357
if (NULL == cont_req->cont_complete_list) {
357358
/* progress as many as allowed */
358359
return ompi_continue_progress_n(cont_req->continue_max_poll, tld);
@@ -364,6 +365,8 @@ int ompi_continue_progress_request_n(ompi_cont_request_t *cont_req, uint32_t max
364365
uint32_t completed = 0;
365366
const bool using_threads = opal_using_threads();
366367

368+
tld->in_progress = 1;
369+
367370
/* take the continuations from the local list */
368371
if (using_threads) {
369372
opal_atomic_lock(&cont_req->cont_lock);
@@ -392,17 +395,16 @@ int ompi_continue_progress_request_n(ompi_cont_request_t *cont_req, uint32_t max
392395
}
393396
}
394397

398+
tld->in_progress = 0;
399+
395400
return completed;
396401
}
397402

398403
int ompi_continue_progress_request(ompi_request_t *req)
399404
{
400405
thread_local_data_t *tld = get_tl_data();
401-
if (tld->in_progress) return 0;
402-
tld->in_progress = 1;
403406
ompi_cont_request_t *cont_req = (ompi_cont_request_t *)req;
404407
int rc = ompi_continue_progress_request_n(cont_req, cont_req->continue_max_poll, tld);
405-
tld->in_progress = 0;
406408
return rc;
407409
}
408410

0 commit comments

Comments
 (0)