New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kqueue: use EVFILT_USER as wakeup event if available #4330
base: v1.x
Are you sure you want to change the base?
Conversation
Huh, a few confusing test failures surface. |
I experimented with EVFILT_USER around 2013 and I remember it was broken on macos. Looks like it still is? I'm afraid I don't really remember the details. Possibly it only worked as a oneshot event, although it seems libevent uses it in multishot mode. |
|
Besides, it looks like Unfortunately, FreeBSD and NetBSD are not available with GitHub Actions, but something like cross-platform-actions may come to help. |
Would it be sensible to try creating a zero-second one shot timer timeout instead? |
I don't think this is the right path. In that way, we're unable to ensure a real-time interruption to |
Isn't it waiting for those anyways? |
No, it isn't. And I think that's why |
A zero second timer should wake it immediately too, though I won't claim to know if that is a useful alternative to the existing pipe |
Kindly ping @bnoordhuis |
After thinking it over, I'm somewhat disinclined to merge this. It's for niche platforms that I personally don't care about, the changes get intermingled with platform code that I do care about, and the real-world performance improvements aren't clear. I could maybe be persuaded if it gave a really good bump on the async handles benchmarks (grep test/benchmark-list.h for "async") but no promises. |
From where I stand, well-testing can justify merging code of improvement. Besides, NetBSD may not catch your attention, but FreeBSD is the Tier-2 support of |
Let's see where other maintainers stand on this. |
--------- Signed-off-by: Andy Pan <[email protected]>
I've finally discovered the root cause that had been failing the tests on macOS before, |
There might be some code conflicts with #4400. |
--------- Signed-off-by: Andy Pan <[email protected]>
--------- Signed-off-by: Andy Pan <[email protected]>
Some references of |
Okay, it wasn't clear that EVFILT_USER was available on XNU. Makes more sense now that is clear it is available in the XNU sources, just not documented. Could you run the benchmark on this? |
Environment
Benchmark commandbuild/uv_run_benchmarks_a million_async Benchmark resultsBranch: libuv:v1.x ok 1 - million_async
# 10,348,986 async events in 5.0 seconds (2,069,797/s, 1,048,576 unique handles seen) Branch: panjf2000:kqueue-wake ok 1 - million_async
# 12,977,383 async events in 5.0 seconds (2,595,476/s, 1,048,576 unique handles seen) |
Nice! |
--------- Signed-off-by: Andy Pan <[email protected]>
Eliminate the kernel overhead of
pipe
if we can.