From: Vadim Lobanov <vlobanov@speakeasy.net>
To: akpm@osdl.org, hch@lst.de, linux-kernel@vger.kernel.org
Subject: [PATCH] fdtable: Provide free_fdtable() wrapper.
Date: Tue, 19 Dec 2006 22:33:45 -0800 [thread overview]
Message-ID: <1166596425.20073.2.camel@localhost.localdomain> (raw)
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);
}
}
reply other threads:[~2006-12-20 6:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1166596425.20073.2.camel@localhost.localdomain \
--to=vlobanov@speakeasy.net \
--cc=akpm@osdl.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®