From 048c640a64fd064361382a8800de05c87ff630cb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Jun 2024 11:10:14 +0200 Subject: executor: optimize waiting for child processes exit Currently we sleep only for 1 ms, which may produce some excessive CPU load (we usually have 6/8 such processes waiting). Make it sleep for 10 ms, but also make the sleep return immediately on child exit. This shuold both improve latency and reduce CPU load. --- executor/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'executor/common.h') diff --git a/executor/common.h b/executor/common.h index fdbf4bcb1..3a735a086 100644 --- a/executor/common.h +++ b/executor/common.h @@ -678,9 +678,9 @@ static void loop(void) uint32 executed_calls = __atomic_load_n(output_data, __ATOMIC_RELAXED); #endif for (;;) { + sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; - sleep_ms(1); #if SYZ_EXECUTOR // Even though the test process executes exit at the end // and execution time of each syscall is bounded by syscall_timeout_ms (~50ms), -- cgit mrf-deployment