From: Matthew Wilcox <willy@infradead.org>
To: "Kernel.org Bugbot" <bugbot@kernel.org>
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org,
linux-fsdevel@vger.kernel.org, bugs@lists.linux.dev
Subject: Re: large pause when opening file descriptor which is power of 2
Date: Wed, 26 Apr 2023 20:13:37 +0100 [thread overview]
Message-ID: <ZEl34WthS8UNJnNd@casper.infradead.org> (raw)
In-Reply-To: <20230426-b217366c0-53b6841a1f9a@bugzilla.kernel.org>
On Wed, Apr 26, 2023 at 05:58:06PM +0000, Kernel.org Bugbot wrote:
> When running a threaded program, and opening a file descriptor that
> is a power of 2 (starting at 64), the call takes a very long time to
> complete. Normally such a call takes less than 2us. However with this
> issue, I've seen the call take up to around 50ms. Additionally this only
> happens the first time, and not subsequent times that file descriptor is
> used. I'm guessing there might be some expansion of some internal data
> structures going on. But I cannot see why this process would take so long.
Because we allocate a new block of memory and then memcpy() the old
block of memory into it. This isn't surprising behaviour to me.
I don't think there's much we can do to change it (Allocating a
segmented array of file descriptors has previously been vetoed by
people who have programs with a million file descriptors). Is it
causing you problems?
next prev parent reply other threads:[~2023-04-26 19:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 17:58 large pause when opening file descriptor which is power of 2 Kernel.org Bugbot
2023-04-26 19:13 ` Matthew Wilcox [this message]
2023-04-26 19:46 ` Al Viro
2023-04-26 19:56 ` Matthew Wilcox
2023-04-26 20:33 ` Al Viro
2023-04-26 19:58 ` Al Viro
2023-04-26 23:42 ` Kernel.org Bugbot
2023-04-27 9:28 ` Christian Brauner
2023-04-27 18:18 ` Matthew Wilcox
2023-04-28 0:37 ` Kernel.org Bugbot
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=ZEl34WthS8UNJnNd@casper.infradead.org \
--to=willy@infradead.org \
--cc=brauner@kernel.org \
--cc=bugbot@kernel.org \
--cc=bugs@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).