Skip to content

Commit e4f920f

Browse files
committed
opal/progress: improve performance when there are no LP callbacks
This commit adds another check to the low-priority callback conditional that short-circuits the atomic-add if there are no low-priority callbacks. This should improve performance in the common case. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 143a93f commit e4f920f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opal/runtime/opal_progress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ opal_progress(void)
221221
events += (callbacks[i])();
222222
}
223223

224-
if ((OPAL_THREAD_ADD32((volatile int32_t *) &num_calls, 1) & 0x7) == 0) {
224+
if (callbacks_lp_len > 0 && (OPAL_THREAD_ADD32((volatile int32_t *) &num_calls, 1) & 0x7) == 0) {
225225
/* run low priority callbacks once every 8 calls to opal_progress() */
226226
for (i = 0 ; i < callbacks_lp_len ; ++i) {
227227
events += (callbacks_lp[i])();

0 commit comments

Comments
 (0)