Closed vlovich closed 7 months ago
Instrumenting the code, I see process_timers
getting invoked twice almost instantaneously (which is strange since it's way into the future) and then twice after ~40ms.
One potential thing I'm investigating is whether the preemption timer is fighting with the user timer since they both clobber the same Source in uring.rs (latency_preemption_timeout_src
).
No that was a dead end. I did write a very simple program to verify that io_uring by itself does indeed wake up within the 10ms requested.
I instrumented a bunch of stuff within glommio and as best I can tell the sys_membarrier sycall is the thing that's taking all that time. If I switch to the mprotect or fallback strategy, the timers complete normally.
Ok. Thankfully it's much simpler. This only happens on the first timer because it takes that long to register the membarrier when you have more than 1 thread & all Rust tests have 2 threads.
Given that the strategy is almost certainly going to be used, I feel like we should front-load that when we construct the executor in the first place to avoid this latency.
For the following test case I see
std::thread::sleep
take ~11ms butTimer
can take up to 40+ms. That's a surprising amount of added latency and I don't see anything in the docs calling this out as intended behavior so figured I'd file a bug while I investigate.