Skip to content

Commit c13d026

Browse files
DAOS-8781 client: allow polling timeout to be modified via env (#12124)
Introduce a new env variable called D_POLL_TIMEOUT in libdaos to tune how aggressive the polling on network progress is for synchronous operation. For asynchronous operations, the caller already passes a timeout to eq_poll or event_test. The default value (0) is not changed and means busy polling. This can be modified to a value in micro-seconds. Signed-off-by: Johann Lombardi <[email protected]>
1 parent 0bd8218 commit c13d026

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

docs/admin/env_variables.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Environment variables in this section only apply to the client side.
6868
|Variable |Description|
6969
|-------------------------|-----------|
7070
|FI\_MR\_CACHE\_MAX\_COUNT|Enable MR (Memory Registration) caching in OFI layer. Recommended to be set to 0 (disable) when CRT\_DISABLE\_MEM\_PIN is NOT set to 1. INTEGER. Default to unset.|
71+
|D\_POLL\_TIMEOUT|Polling timeout passed to network progress for synchronous operations. Default to 0 (busy polling), value in micro-seconds otherwise.|
7172

7273

7374
## Debug System (Client & Server)

src/cart/crt_init.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ dump_envariables(void)
7171
"CRT_CTX_SHARE_ADDR", "CRT_CTX_NUM", "D_FI_CONFIG",
7272
"FI_UNIVERSE_SIZE", "CRT_ENABLE_MEM_PIN",
7373
"FI_OFI_RXM_USE_SRX", "D_LOG_FLUSH", "CRT_MRC_ENABLE",
74-
"CRT_SECONDARY_PROVIDER", "D_PROVIDER_AUTH_KEY", "D_PORT_AUTO_ADJUST"};
74+
"CRT_SECONDARY_PROVIDER", "D_PROVIDER_AUTH_KEY", "D_PORT_AUTO_ADJUST",
75+
"D_POOL_TIMEOUT"};
7576

7677
D_INFO("-- ENVARS: --\n");
7778
for (i = 0; i < ARRAY_SIZE(envars); i++) {

src/client/api/event.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
static __thread daos_event_t ev_thpriv;
2121
static __thread bool ev_thpriv_is_init;
2222

23+
/**
24+
* Global progress timeout for synchronous operation
25+
* busy-polling by default (0), timeout in us otherwise
26+
*/
27+
static uint32_t ev_prog_timeout;
28+
2329
#define EQ_WITH_CRT
2430

2531
#if !defined(EQ_WITH_CRT)
@@ -91,6 +97,8 @@ daos_eq_lib_init()
9197

9298
eq_ref = 1;
9399

100+
d_getenv_int("D_POLL_TIMEOUT", &ev_prog_timeout);
101+
94102
unlock:
95103
D_MUTEX_UNLOCK(&daos_eq_lock);
96104
return rc;
@@ -1262,7 +1270,7 @@ daos_event_priv_wait()
12621270

12631271
/* Wait on the event to complete */
12641272
while (evx->evx_status != DAOS_EVS_READY) {
1265-
rc = crt_progress_cond(evx->evx_ctx, 0, ev_progress_cb, &epa);
1273+
rc = crt_progress_cond(evx->evx_ctx, ev_prog_timeout, ev_progress_cb, &epa);
12661274

12671275
/** progress succeeded, loop can exit if event completed */
12681276
if (rc == 0) {

0 commit comments

Comments
 (0)