diff options
author | Vadim Lobanov <vlobanov@speakeasy.net> | 2006-12-10 02:21:22 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 09:57:22 -0800 |
commit | 5466b456ed6748e0bfe02831e570004d4c04c1d7 (patch) | |
tree | 90afd9e5142edb8f9a6facee7258ed2c556a6d9b /drivers/char | |
parent | 4fd45812cbe875a620c86a096a5d46c742694b7e (diff) | |
download | linux-rpi3-5466b456ed6748e0bfe02831e570004d4c04c1d7.tar.gz linux-rpi3-5466b456ed6748e0bfe02831e570004d4c04c1d7.tar.bz2 linux-rpi3-5466b456ed6748e0bfe02831e570004d4c04c1d7.zip |
[PATCH] fdtable: Implement new pagesize-based fdtable allocator
This patch provides an improved fdtable allocation scheme, useful for
expanding fdtable file descriptor entries. The main focus is on the fdarray,
as its memory usage grows 128 times faster than that of an fdset.
The allocation algorithm sizes the fdarray in such a way that its memory usage
increases in easy page-sized chunks. The overall algorithm expands the allowed
size in powers of two, in order to amortize the cost of invoking vmalloc() for
larger allocation sizes. Namely, the following sizes for the fdarray are
considered, and the smallest that accommodates the requested fd count is
chosen:
pagesize / 4
pagesize / 2
pagesize <- memory allocator switch point
pagesize * 2
pagesize * 4
...etc...
Unlike the current implementation, this allocation scheme does not require a
loop to compute the optimal fdarray size, and can be done in efficient
straightline code.
Furthermore, since the fdarray overflows the pagesize boundary long before any
of the fdsets do, it makes sense to optimize run-time by allocating both
fdsets in a single swoop. Even together, they will still be, by far, smaller
than the fdarray. The fdtable->open_fds is now used as the anchor for the
fdset memory allocation.
Signed-off-by: Vadim Lobanov <vlobanov@speakeasy.net>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Dipankar Sarma <dipankar@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
0 files changed, 0 insertions, 0 deletions