From: Benjamin LaHaise <bcrl@linux.intel.com>
To: akpm@osdl.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] get_empty_filp tweaks, inline epoll_init_file()
Date: Mon, 23 Jan 2006 21:28:20 -0800 [thread overview]
Message-ID: <20060124052820.GA16694@linux.intel.com> (raw)
This patch eliminates a handful of cache references by keeping current
in a register instead of reloading (helps x86) and avoiding the overhead
of a function call. Inlining eventpoll_init_file() saves 24 bytes. Also
reorder file initialization to make writes occur more sequentially.
Signed-off-by: Benjamin LaHaise <bcrl@linux.intel.com>
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 4284cd3..e536e79 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -451,15 +451,6 @@ static void ep_poll_safewake(struct poll
}
-/* Used to initialize the epoll bits inside the "struct file" */
-void eventpoll_init_file(struct file *file)
-{
-
- INIT_LIST_HEAD(&file->f_ep_links);
- spin_lock_init(&file->f_ep_lock);
-}
-
-
/*
* This is called from eventpoll_release() to unlink files from the eventpoll
* interface. We need to have this facility to cleanup correctly files that are
diff --git a/fs/file_table.c b/fs/file_table.c
index 768b581..67c4106 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -72,6 +72,7 @@ static inline void file_free(struct file
*/
struct file *get_empty_filp(void)
{
+ struct task_struct *tsk;
static int old_max;
struct file * f;
@@ -90,13 +91,14 @@ struct file *get_empty_filp(void)
if (security_file_alloc(f))
goto fail_sec;
- eventpoll_init_file(f);
+ tsk = current;
+ INIT_LIST_HEAD(&f->f_u.fu_list);
atomic_set(&f->f_count, 1);
- f->f_uid = current->fsuid;
- f->f_gid = current->fsgid;
rwlock_init(&f->f_owner.lock);
+ f->f_uid = tsk->fsuid;
+ f->f_gid = tsk->fsgid;
+ eventpoll_init_file(f);
/* f->f_version: 0 */
- INIT_LIST_HEAD(&f->f_u.fu_list);
return f;
over:
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 1289f0e..1e4bdfc 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -52,7 +52,12 @@ struct file;
#ifdef CONFIG_EPOLL
/* Used to initialize the epoll bits inside the "struct file" */
-void eventpoll_init_file(struct file *file);
+static inline void eventpoll_init_file(struct file *file)
+{
+ INIT_LIST_HEAD(&file->f_ep_links);
+ spin_lock_init(&file->f_ep_lock);
+}
+
/* Used to release the epoll bits inside the "struct file" */
void eventpoll_release_file(struct file *file);
@@ -85,7 +90,6 @@ static inline void eventpoll_release(str
eventpoll_release_file(file);
}
-
#else
static inline void eventpoll_init_file(struct file *file) {}
next reply other threads:[~2006-01-24 5:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-24 5:28 Benjamin LaHaise [this message]
2006-01-24 5:44 ` [PATCH] get_empty_filp tweaks, inline epoll_init_file() Andrew Morton
2006-01-24 5:49 ` Benjamin LaHaise
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=20060124052820.GA16694@linux.intel.com \
--to=bcrl@linux.intel.com \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).