aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/file.h
diff options
context:
space:
mode:
authorVadim Lobanov <vlobanov@speakeasy.net>2006-12-10 05:21:22 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-10 12:57:22 -0500
commit5466b456ed6748e0bfe02831e570004d4c04c1d7 (patch)
tree90afd9e5142edb8f9a6facee7258ed2c556a6d9b /include/linux/file.h
parent4fd45812cbe875a620c86a096a5d46c742694b7e (diff)
[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 'include/linux/file.h')
-rw-r--r--include/linux/file.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/include/linux/file.h b/include/linux/file.h
index 319118f275b0..edca361f2ab4 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -76,12 +76,6 @@ extern int get_unused_fd(void);
76extern void FASTCALL(put_unused_fd(unsigned int fd)); 76extern void FASTCALL(put_unused_fd(unsigned int fd));
77struct kmem_cache; 77struct kmem_cache;
78 78
79extern struct file ** alloc_fd_array(int);
80extern void free_fd_array(struct file **, int);
81
82extern fd_set *alloc_fdset(int);
83extern void free_fdset(fd_set *, int);
84
85extern int expand_files(struct files_struct *, int nr); 79extern int expand_files(struct files_struct *, int nr);
86extern void free_fdtable_rcu(struct rcu_head *rcu); 80extern void free_fdtable_rcu(struct rcu_head *rcu);
87extern void __init files_defer_init(void); 81extern void __init files_defer_init(void);