Review and improve the behavior of fork.py
In [#18748] the code was changed to use poll/epoll instead of select when possible.
There may be some performance improvements to gain changing the current code.
1. The current code seems to create a new mask for poll/epoll all the time fetch_ready_fork_result_list() is callded.
Specially epoll should work much better if a mask is kept (e.g. as module variable) and file descriptors are added/removed to it when needed. Each modification is supposedly a system call
2. Epoll may not guarantee always the best performance. poll and select work in user space so should cause less context switches than epoll. Select (in C) should work also for >1024 file descriptors if the correct array is passed in (default is 1024 long and would break). Python select.select() seems not to allow an input array. It remains to be verified if there is a way around it. # TODO: this may be revised to use select that seems more performant and able to support >1024: https://aivarsk.github.io/2017/04/06/select/
When working on this keep in mind that most python code examples for select/poll/epoll seem superficial. E.g. there is confusion on the meaning of the select flags: read as POLLIN | POLLPRI, no mention of the POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR).
Consider also [#18855], the ticket about creating a unit test. The test may also compare performance.