From: Richard Henderson <richard.henderson@linaro.org>
To: Bin Meng <bmeng@tinylab.org>, qemu-devel@nongnu.org
Cc: "Zhangjin Wu" <falcon@tinylab.org>,
"David Hildenbrand" <david@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Nikita Ivanov" <nivanov@cloudlinux.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Xuzhou Cheng" <xuzhou.cheng@windriver.com>
Subject: Re: [PATCH v2 4/6] utils/osdep: Introduce qemu_close_range()
Date: Mon, 19 Jun 2023 09:07:37 +0200 [thread overview]
Message-ID: <9e7b2d1f-b6cb-83fe-7445-3e3cdfdbcccc@linaro.org> (raw)
In-Reply-To: <20230616152737.23545-5-bmeng@tinylab.org>
On 6/16/23 17:27, Bin Meng wrote:
> +int qemu_close_range(unsigned int first, unsigned int last)
> +{
> + DIR *dir = NULL;
> +
> +#ifdef CONFIG_CLOSE_RANGE
> + int r = close_range(first, last, 0);
> + if (!r) {
> + /* Success, no need to try other ways. */
> + return 0;
> + }
> +#endif
What about first > last?
close_range will yield EINVAL, and your other fallbacks will burn lots of cpu.
r~
next prev parent reply other threads:[~2023-06-19 7:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 15:27 [PATCH v2 0/6] net/tap: Fix QEMU frozen issue when the maximum number of file descriptors is very large Bin Meng
2023-06-16 15:27 ` [PATCH v2 1/6] tests/tcg/cris: Fix the coding style Bin Meng
2023-06-19 6:55 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 2/6] tests/tcg/cris: Correct the off-by-one error Bin Meng
2023-06-19 6:55 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 3/6] util/async-teardown: Fall back to close fds one by one Bin Meng
2023-06-19 6:59 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 4/6] utils/osdep: Introduce qemu_close_range() Bin Meng
2023-06-19 7:03 ` Richard Henderson
2023-06-19 7:07 ` Richard Henderson [this message]
2023-06-16 15:27 ` [PATCH v2 5/6] util/async-teardown: Use qemu_close_range() to close fds Bin Meng
2023-06-19 7:05 ` Richard Henderson
2023-06-16 15:27 ` [PATCH v2 6/6] net: tap: " Bin Meng
2023-06-19 7:08 ` Richard Henderson
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=9e7b2d1f-b6cb-83fe-7445-3e3cdfdbcccc@linaro.org \
--to=richard.henderson@linaro.org \
--cc=bmeng@tinylab.org \
--cc=david@redhat.com \
--cc=falcon@tinylab.org \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=nivanov@cloudlinux.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=xuzhou.cheng@windriver.com \
/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).