summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorVadim Lobanov <vlobanov@speakeasy.net>2006-12-10 02:21:17 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-10 09:57:22 -0800
commit4fd45812cbe875a620c86a096a5d46c742694b7e (patch)
tree8d2c99caa718da6cda87229076adf708494ff251 /kernel
parentbbea9f69668a3d0cf9feba15a724cd02896f8675 (diff)
downloadop-kernel-dev-4fd45812cbe875a620c86a096a5d46c742694b7e.zip
op-kernel-dev-4fd45812cbe875a620c86a096a5d46c742694b7e.tar.gz
[PATCH] fdtable: Remove the free_files field
An fdtable can either be embedded inside a files_struct or standalone (after being expanded). When an fdtable is being discarded after all RCU references to it have expired, we must either free it directly, in the standalone case, or free the files_struct it is contained within, in the embedded case. Currently the free_files field controls this behavior, but we can get rid of it entirely, as all the necessary information is already recorded. We can distinguish embedded and standalone fdtables using max_fds, and if it is embedded we can divine the relevant files_struct using container_of(). 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 'kernel')
-rw-r--r--kernel/exit.c6
-rw-r--r--kernel/fork.c1
2 files changed, 2 insertions, 5 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 5f77e76..122fadb 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -466,11 +466,9 @@ void fastcall put_files_struct(struct files_struct *files)
* you can free files immediately.
*/
fdt = files_fdtable(files);
- if (fdt == &files->fdtab)
- fdt->free_files = files;
- else
+ if (fdt != &files->fdtab)
kmem_cache_free(files_cachep, files);
- free_fdtable(fdt);
+ call_rcu(&fdt->rcu, free_fdtable_rcu);
}
}
diff --git a/kernel/fork.c b/kernel/fork.c
index aba5954..d16c566 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -645,7 +645,6 @@ static struct files_struct *alloc_files(void)
fdt->open_fds = (fd_set *)&newf->open_fds_init;
fdt->fd = &newf->fd_array[0];
INIT_RCU_HEAD(&fdt->rcu);
- fdt->free_files = NULL;
fdt->next = NULL;
rcu_assign_pointer(newf->fdt, fdt);
out:
OpenPOWER on IntegriCloud