Skip to content

Commit

Permalink
NA OFI: yield to other threads when using PSM2
Browse files Browse the repository at this point in the history
When not yielding, a thread dedicated to progress would busy spin
and not allow for other threads to be scheduled.
  • Loading branch information
soumagne committed Feb 10, 2021
1 parent 9e1f4fb commit 3c63a13
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/na/na_ofi.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#include <inttypes.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -5060,6 +5061,11 @@ na_ofi_progress(
}
} while ((int) (remaining * 1000.0) > 0);

/* PSM2 is a user-level interface, to prevent busy-spin and allow
* other threads to be scheduled, we need to yield here. */
if (NA_OFI_CLASS(na_class)->domain->prov_type == NA_OFI_PROV_PSM2)
sched_yield();

return NA_TIMEOUT;

error:
Expand Down

0 comments on commit 3c63a13

Please sign in to comment.