Skip to content

split out os_close_all_open_fd and use it in net/tap.c too

Michael Tokarev qemu-devel qemu-trivial 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2close_all_open_fd(): move to oslib-posix.cinclude/sysemu/os-posix.h system/async-teardown.c util/oslib-posix.c+38 -365 replies
2/2net/tap: use os_close_all_open_fd() instead of open-coding itnet/tap.c+2 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH trivial 0/2] split out os_close_all_open_fd and use it in net/tap.c too

We have at least two places in qemu where we're closing all possible file descriptors, - in async-teardown.c and in net/tap.c. While async-teardown one uses either close_range() or readdir(/proc/self/fd), the two calls in net/tap.c loops from 3 to RLIMIT_NOFILE, which might be quite slow, and it actually *is* slow on some systems (eg, just qemu-system-x86_64 startup with a tap device is very slow on alpine linux).

While for net/tap.c, maybe the better fix is to get rid of this closing entirely and use O_CLOEXEC instead, this needs to be prepared at first, while we alredy have almost ready-to-be-used implementation which only needs to be moved into a common place.

Michael Tokarev (2):
close_all_open_fd(): move to oslib-posix.c
net/tap: use os_close_all_open_fd() instead of open-coding it

 include/sysemu/os-posix.h |  1 +
 net/tap.c                 | 15 ++-------------
 system/async-teardown.c   | 37 +------------------------------------
 util/oslib-posix.c        | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 49 deletions(-)
Signature · 1 line
2.39.2