diff options
author | Vadim Lobanov <vlobanov@speakeasy.net> | 2006-12-10 05:21:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:57:22 -0500 |
commit | bbea9f69668a3d0cf9feba15a724cd02896f8675 (patch) | |
tree | bc58506e4daba4a04309181a5501ae4eb5424783 /security/selinux/hooks.c | |
parent | f3d19c90fb117a5f080310a4592929aa8e1ad8e9 (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 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 3753416eb9b9..65fb5e8ea941 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1734,7 +1734,7 @@ static inline void flush_unauthorized_files(struct files_struct * files) | |||
1734 | j++; | 1734 | j++; |
1735 | i = j * __NFDBITS; | 1735 | i = j * __NFDBITS; |
1736 | fdt = files_fdtable(files); | 1736 | fdt = files_fdtable(files); |
1737 | if (i >= fdt->max_fds || i >= fdt->max_fdset) | 1737 | if (i >= fdt->max_fds) |
1738 | break; | 1738 | break; |
1739 | set = fdt->open_fds->fds_bits[j]; | 1739 | set = fdt->open_fds->fds_bits[j]; |
1740 | if (!set) | 1740 | if (!set) |