-
Notifications
You must be signed in to change notification settings - Fork 83
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
Speed up close_fds with the new close_range() Linux/FreeBSD syscall #189
Comments
Since you're closing all fds you could call it with the
The kernel will detect that you're closing all file descriptors and will make a copy of only the first three file descriptors and doesn't need to do any actual work closing all the others. Obviously if you do this in threaded environment than you can't use it if you want to close the fds for all threads. :) |
I've just come upon a really pathological behavior surrounding this code which happens when the call to On my Ubuntu machine, But then I found a system (Kind Kubernetes environment on NixOS) where that variable is So I'd request two things:
|
Background:
As written in
process/System/Process/Common.hs
Line 91 in cb1d1a6
The new
close_range()
syscall solves this, closing them all in 1 go. According to the LWN link, it is very fast, and you can give itMAXINT
.The code that needs to be augmented (with CPP):
process/cbits/posix/runProcess.c
Lines 255 to 273 in cb1d1a6
The text was updated successfully, but these errors were encountered: