X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=fs%2Ffile.c;h=4c2cacca4e2e9142cf13497db6a4d3a3efb8b54b;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=b3c6b82e6a9d8629446e77268a83a2c5c4eb1b62;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/fs/file.c b/fs/file.c index b3c6b82e6..4c2cacca4 100644 --- a/fs/file.c +++ b/fs/file.c @@ -240,9 +240,13 @@ static struct fdtable *alloc_fdtable(int nr) if (!fdt) goto out; - nfds = max_t(int, 8 * L1_CACHE_BYTES, roundup_pow_of_two(nr + 1)); - if (nfds > NR_OPEN) - nfds = NR_OPEN; + nfds = 8 * L1_CACHE_BYTES; + /* Expand to the max in easy steps */ + while (nfds <= nr) { + nfds = nfds * 2; + if (nfds > NR_OPEN) + nfds = NR_OPEN; + } new_openset = alloc_fdset(nfds); new_execset = alloc_fdset(nfds);