patch: minimize calls to close() in spawn by calling poll()
Casey Tucker
dctucker at github.com
Sun Nov 18 20:49:01 CET 2018
> FWIW, the parent of Casey's commit is fff2049c1bc7 (from 2014...), which
> didn't have this /proc/self/fd thing. Huh?
Thank you for pointing this out. Since the default branch on the
github mirror is set to `bjk/master`, I erroneously assumed it was the
latest and greatest. I'll target `master` in the next patch.
> Have you investigated why get_max_fd does not work for you. On Linux
> that function is is used to detect the highest used file descriptor by
> reading /proc/self/fd/. Or is your application really using that many
> fds?
In our application, we are using an older version of GPGME, version
1.9 by way of ueno/ruby-gpgme. I will attempt to backport the newer
`get_max_fds` code to improve performance. We did verify that the
application is not generating a high number of file descriptors by
running perf against GPGME tests, ruby-gpgme tests, and our
applicaton's tests, and seeing a similarly high number of close calls
running.
> Minor nitpicks: The code assumes that poll is available. It should also
> not used TRACE because that may allocate memory and thus can lead to a
> deadlock.
poll() is available since Linux 2.1.23; what is the preferred macro to
determine whether to use poll(); should we include linux/version.h if
available and check `LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,23)`?
I can remove the TRACE.
More information about the Gnupg-devel
mailing list