Speed up close_fds with the new close_range() Linux/FreeBSD syscall
- Dominant language
- Haskell
- Stars
- 91
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
Background:
* https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.9-Close-Range
* https://lwn.net/Articles/789023/
As written in https://github.com/haskell/process/blob/cb1d1a6ead68f0e1b209277e79ec608980e9ac84/System/Process/Common.hs#L91
> This implementation will call `close()` an every fd from 3 to the maximum of open files, which can be slow for high maximum of open files.
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 it `MAXINT`.
The code that needs to be augmented (with CPP):
https://github.com/haskell/process/blob/cb1d1a6ead68f0e1b209277e79ec608980e9ac84/cbits/posix/runProcess.c#L255-L273
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.