From e4f920f6f96a02fd88811aafb2aa41aaad2ad83e Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 22 Jun 2016 09:50:46 -0600 Subject: [PATCH] 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 --- opal/runtime/opal_progress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/runtime/opal_progress.c b/opal/runtime/opal_progress.c index 896b2d19a9..2af67c8ad8 100644 --- a/opal/runtime/opal_progress.c +++ b/opal/runtime/opal_progress.c @@ -221,7 +221,7 @@ opal_progress(void) events += (callbacks[i])(); } - if ((OPAL_THREAD_ADD32((volatile int32_t *) &num_calls, 1) & 0x7) == 0) { + if (callbacks_lp_len > 0 && (OPAL_THREAD_ADD32((volatile int32_t *) &num_calls, 1) & 0x7) == 0) { /* run low priority callbacks once every 8 calls to opal_progress() */ for (i = 0 ; i < callbacks_lp_len ; ++i) { events += (callbacks_lp[i])();