Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit bcd640a

Browse files
committed
opal_progress: add a MCA variable to control lp progress
This commit adds a MCA variable to control how often low-priority callbacks are made relative to high-priority callbacks. This was added per discussion on telcon on May 24, 2016. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 148dd57 commit bcd640a

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

opal/runtime/opal_params.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ int opal_leave_pinned = -1;
6666
bool opal_leave_pinned_pipeline = false;
6767
bool opal_abort_print_stack = false;
6868
int opal_abort_delay = 0;
69+
int opal_progress_lp_call_ratio = 8;
6970

7071
static bool opal_register_done = false;
7172

@@ -279,6 +280,23 @@ int opal_register_params(void)
279280
return ret;
280281
}
281282

283+
opal_progress_lp_call_ratio = 8;
284+
ret = mca_base_var_register("opal", "opal", NULL, "progress_lp_call_ratio",
285+
"Ratio of calls to high-priority to low-priority progress "
286+
"functions. Higher numbers decrease the low-priority callback "
287+
"rate. Must be a power of two (default: 8)",
288+
MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0,
289+
OPAL_INFO_LVL_5,
290+
MCA_BASE_VAR_SCOPE_READONLY,
291+
&opal_progress_lp_call_ratio);
292+
if (0 > ret) {
293+
return ret;
294+
}
295+
296+
if (opal_progress_lp_call_ratio & (opal_progress_lp_call_ratio - 1)) {
297+
opal_progress_lp_call_ratio = (unsigned int) opal_next_poweroftwo_inclusive ((int) opal_progress_lp_call_ratio);
298+
}
299+
282300
opal_abort_print_stack = false;
283301
ret = mca_base_var_register("opal", "opal", NULL, "abort_print_stack",
284302
"If nonzero, print out a stack trace when abort is invoked",

opal/runtime/opal_params.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ OPAL_DECLSPEC extern bool opal_abort_print_stack;
7373
*/
7474
OPAL_DECLSPEC extern int opal_abort_delay;
7575

76+
/**
77+
* Ratio of calls to high-priority to low-priority progress functions.
78+
* Must be a power of two.
79+
*/
80+
OPAL_DECLSPEC extern unsigned int opal_progress_lp_call_ratio;
81+
7682
#if OPAL_ENABLE_DEBUG
7783
extern bool opal_progress_debug;
7884
#endif

opal/runtime/opal_progress.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static size_t callbacks_size = 0;
6262
static opal_progress_callback_t *callbacks_lp = NULL;
6363
static size_t callbacks_lp_len = 0;
6464
static size_t callbacks_lp_size = 0;
65+
static uint64_t callbacks_lp_mask = 0x7;
6566

6667
/* do we want to call sched_yield() if nothing happened */
6768
bool opal_progress_yield_when_idle = false;
@@ -109,6 +110,8 @@ opal_progress_init(void)
109110
}
110111
#endif
111112

113+
callbacks_lp_mask = opal_progress_lp_call_ratio - 1;
114+
112115
OPAL_OUTPUT((debug_output, "progress: initialized event flag to: %x",
113116
opal_progress_event_flag));
114117
OPAL_OUTPUT((debug_output, "progress: initialized yield_when_idle to: %s",
@@ -194,7 +197,7 @@ opal_progress(void)
194197
events += (callbacks[i])();
195198
}
196199

197-
if ((OPAL_THREAD_ADD64((volatile int64_t *) &num_calls, 1) & 0x7) == 0) {
200+
if ((OPAL_THREAD_ADD64((volatile int64_t *) &num_calls, 1) & callbacks_lp_mask) == 0) {
198201
/* run low priority callbacks once every 8 calls to opal_progress() */
199202
for (i = 0 ; i < callbacks_lp_len ; ++i) {
200203
events += (callbacks_lp[i])();

0 commit comments

Comments
 (0)