mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fdtable: Provide free_fdtable() wrapper.
@ 2006-12-20  6:33 Vadim Lobanov
  0 siblings, 0 replies; only message in thread
From: Vadim Lobanov @ 2006-12-20  6:33 UTC (permalink / raw)
  To: akpm, hch, linux-kernel

Hi,

Christoph Hellwig has expressed concerns that the recent fdtable changes
expose the details of the RCU methodology used to release no-longer-used
fdtable structures to the rest of the kernel. The trivial patch below
addresses these concerns by introducing the appropriate free_fdtable() calls,
which simply wrap the release RCU usage. Since free_fdtable() is a one-liner,
it makes sense to promote it to an inline helper.

Please apply.

Signed-off-by: Vadim Lobanov <vlobanov@speakeasy.net>

diff -pru old/fs/file.c new/fs/file.c
--- old/fs/file.c	2006-12-19 19:54:23.000000000 -0800
+++ new/fs/file.c	2006-12-19 20:04:02.000000000 -0800
@@ -206,7 +206,7 @@ static int expand_fdtable(struct files_s
 		copy_fdtable(new_fdt, cur_fdt);
 		rcu_assign_pointer(files->fdt, new_fdt);
 		if (cur_fdt->max_fds > NR_OPEN_DEFAULT)
-			call_rcu(&cur_fdt->rcu, free_fdtable_rcu);
+			free_fdtable(cur_fdt);
 	} else {
 		/* Somebody else expanded, so undo our attempt */
 		free_fdarr(new_fdt);
diff -pru old/include/linux/file.h new/include/linux/file.h
--- old/include/linux/file.h	2006-12-19 19:54:25.000000000 -0800
+++ new/include/linux/file.h	2006-12-19 20:03:19.000000000 -0800
@@ -80,6 +80,11 @@ extern int expand_files(struct files_str
 extern void free_fdtable_rcu(struct rcu_head *rcu);
 extern void __init files_defer_init(void);
 
+static inline void free_fdtable(struct fdtable *fdt)
+{
+	call_rcu(&fdt->rcu, free_fdtable_rcu);
+}
+
 static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
 {
 	struct file * file = NULL;
diff -pru old/kernel/exit.c new/kernel/exit.c
--- old/kernel/exit.c	2006-12-19 19:54:52.000000000 -0800
+++ new/kernel/exit.c	2006-12-19 20:04:20.000000000 -0800
@@ -466,7 +466,7 @@ void fastcall put_files_struct(struct fi
 		fdt = files_fdtable(files);
 		if (fdt != &files->fdtab)
 			kmem_cache_free(files_cachep, files);
-		call_rcu(&fdt->rcu, free_fdtable_rcu);
+		free_fdtable(fdt);
 	}
 }
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-20  6:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-20  6:33 [PATCH] fdtable: Provide free_fdtable() wrapper Vadim Lobanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®