Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luaext/Pexec: optimize setting CLOEXEC
In case maximum number of open files limit is set too high, Pexec() spends way too much time trying to set FD_CLOEXEC for all those file descriptors, resulting in severe increase of time it takes to execute rpm or dnf. For example, this happens while running under Docker because: > $ docker run fedora ulimit -n > 1048576 One obvious fix is when open_max is too big, use procfs to get the actual list of opened file descriptors and iterate over those. My quick-n-dirty benchmark shows the /proc approach is about 10x faster than iterating through a list of 1024 fds. Note that the old method is still used in case /proc is not available. This should fix: - moby/moby#23137 - https://bugzilla.redhat.com/show_bug.cgi?id=1537564 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Loading branch information