qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>
Subject: [PATCH trivial 0/2] split out os_close_all_open_fd and use it in net/tap.c too
Date: Fri, 26 Jan 2024 01:29:34 +0300	[thread overview]
Message-ID: <cover.1706221377.git.mjt@tls.msk.ru> (raw)

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(-)

-- 
2.39.2



             reply	other threads:[~2024-01-25 22:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 22:29 Michael Tokarev [this message]
2024-01-25 22:29 ` [PATCH trivial 1/2] close_all_open_fd(): move to oslib-posix.c Michael Tokarev
2024-01-26  7:44   ` Laurent Vivier
2024-01-26  9:06     ` Daniel P. Berrangé
2024-01-26 10:45       ` Michael Tokarev
2024-01-26 11:01         ` Daniel P. Berrangé
2024-01-26 12:05           ` Michael Tokarev
2024-01-25 22:29 ` [PATCH trivial 2/2] net/tap: use os_close_all_open_fd() instead of open-coding it Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1706221377.git.mjt@tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).