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?