From: Eric Dumazet <dada1@cosmosbay.com>
To: Vadim Lobanov <vlobanov@speakeasy.net>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] fdtable: Implement new pagesize-based fdtable allocation scheme.
Date: Mon, 2 Oct 2006 19:25:18 +0200 [thread overview]
Message-ID: <200610021925.19069.dada1@cosmosbay.com> (raw)
In-Reply-To: <200610021000.00768.vlobanov@speakeasy.net>
On Monday 02 October 2006 19:00, Vadim Lobanov wrote:
> On Monday 02 October 2006 01:52, Eric Dumazet wrote:
>
> > Current scheme is to allocate power of two sizes, and not 'the smallest
> > that accommodates the requested fd count'. This is for a good reason,
> > because we don't want to call vmalloc()/vfree() each time a process opens
> > 512 or 1024 more files (x86_64 or ia32)
>
> Yep, that is most definitely a consideration. I was balancing it against
> the fact that, when the table becomes big, growing it by a power of two
> regardless of the size results in massive memory usage deltas. The worry
> here is that an application may likely cause the table to grow by a huge
> amount, due to the power-of-two increase, and then actually use only a
> modest number of further fds, wasting the rest of the allocated table
> memory.
>
> Which applications open so many file handles so quickly? Do they actually
> need the amortized power-of-two table area increase? In those cases, would
> the actual process of opening these files take more time than growing the
> table in fixed-size steps? Or at least outweigh it enough that it would be
> more preferable to try to reduce memory waste instead of improve file open
> time?
I think that for such applications, the 'waste' of ram for fd table is nothing
compared to the ram cost of opened files/sockets/dentries/inodes.
>
> Is it really true that it will create less fragmentation? It seems to me
> that this will only be the true if most of the other heavy users of vmalloc
> also tried to use power-of-two allocation sizes.
I am quite sure that on my machines, big vmalloc users are fdtable most of the
time.
>
> What do you think of Andi Kleen's follow-up suggestion about eliminating
> vmalloc use altogether?
It would be interesting, but would need one indirection level, that could kill
performance of said huge applications... For such applications, the cost of
expanding fdtable is nothing compared to the cost of
open()/close()/poll()/read()/write() calls. This is because fdtable never
shrinks. So adding one indirection (if you use a table of pointers to PAGES
containing 1024 or 512 (struct file *)).
At least, expanding fdtable by 1024 slots would need to reallocate the first
table (adding one void *), and allocating one PAGE only. No need to copy
previous pages, this is a win.
Of course, big fdset still need vmalloc(), or else we cannot use
find_next_zero_bit() anymore... And for such applications, the time and
memory scanned to find a zero bit at open() time is probably the killer
(touching a large part of cpu caches). One million bits is 128 KB...
Eric
next prev parent reply other threads:[~2006-10-02 17:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-01 21:14 Vadim Lobanov
2006-10-02 8:52 ` Eric Dumazet
2006-10-02 17:00 ` Vadim Lobanov
2006-10-02 17:25 ` Eric Dumazet [this message]
2006-10-02 17:42 ` Vadim Lobanov
2006-10-02 10:01 ` Andi Kleen
2006-10-02 17:04 ` Vadim Lobanov
2006-10-02 17:30 ` Eric Dumazet
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=200610021925.19069.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vlobanov@speakeasy.net \
/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
Powered by JetHome