aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVadim Lobanov <vlobanov@speakeasy.net>2006-12-10 05:21:12 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-10 12:57:22 -0500
commitbbea9f69668a3d0cf9feba15a724cd02896f8675 (patch)
treebc58506e4daba4a04309181a5501ae4eb5424783 /include
parentf3d19c90fb117a5f080310a4592929aa8e1ad8e9 (diff)
[PATCH] fdtable: Make fdarray and fdsets equal in size
Currently, each fdtable supports three dynamically-sized arrays of data: the fdarray and two fdsets. The code allows the number of fds supported by the fdarray (fdtable->max_fds) to differ from the number of fds supported by each of the fdsets (fdtable->max_fdset). In practice, it is wasteful for these two sizes to differ: whenever we hit a limit on the smaller-capacity structure, we will reallocate the entire fdtable and all the dynamic arrays within it, so any delta in the memory used by the larger-capacity structure will never be touched at all. Rather than hogging this excess, we shouldn't even allocate it in the first place, and keep the capacities of the fdarray and the fdsets equal. This patch removes fdtable->max_fdset. As an added bonus, most of the supporting code becomes simpler. 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')
-rw-r--r--include/linux/file.h6
-rw-r--r--include/linux/init_task.h1
2 files changed, 0 insertions, 7 deletions
diff --git a/include/linux/file.h b/include/linux/file.h
index 6e77b9177f9e..02be4012225b 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -26,14 +26,8 @@ struct embedded_fd_set {
26 unsigned long fds_bits[1]; 26 unsigned long fds_bits[1];
27}; 27};
28 28
29/*
30 * More than this number of fds: we use a separately allocated fd_set
31 */
32#define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set))
33
34struct fdtable { 29struct fdtable {
35 unsigned int max_fds; 30 unsigned int max_fds;
36 int max_fdset;
37 struct file ** fd; /* current fd array */ 31 struct file ** fd; /* current fd array */
38 fd_set *close_on_exec; 32 fd_set *close_on_exec;
39 fd_set *open_fds; 33 fd_set *open_fds;
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 7272ff9ee77c..58c18daab65d 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -12,7 +12,6 @@
12#define INIT_FDTABLE \ 12#define INIT_FDTABLE \
13{ \ 13{ \
14 .max_fds = NR_OPEN_DEFAULT, \ 14 .max_fds = NR_OPEN_DEFAULT, \
15 .max_fdset = EMBEDDED_FD_SET_SIZE, \
16 .fd = &init_files.fd_array[0], \ 15 .fd = &init_files.fd_array[0], \
17 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \ 16 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
18 .open_fds = (fd_set *)&init_files.open_fds_init, \ 17 .open_fds = (fd_set *)&init_files.open_fds_init, \