fs: Removal of unlikely likelys
cover fs: Removal of unlikely likelys
Not sure who to send this to. I've separated out my patch set per system, and I'm sending them out individually. You can simply pull from my repo, or take the patches directly from me.
Or just ignore me and I'll come and bother you again next year ;-)
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: unlikely/fs
Steven Rostedt (2):
fs: Remove unlikely() from fput_light()
fs: Remove unlikely() from fget_light()
----
fs/file_table.c | 2 +- include/linux/file.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
PATCH 1/2 fs: Remove unlikely() from fput_light()
From: Steven Rostedt <[email protected]>
In fput_light(), there's an unlikely(fput_needed), which running on my normal desktop doing firefox, xchat, evolution and part of my distcc farm, and running the annotate branch profiler shows that the unlikely is not very unlikely.
correct incorrect % Function File Line
------- --------- - -------- ---- ----
0 48 100 fput_light file.h 26
115828710 897415279 88 fput_light file.h 26
865271179 5286128445 85 fput_light file.h 26
19568539 8923664 31 fput_light file.h 26
12353677 3562279 22 fput_light file.h 26
267691 67062 20 fput_light file.h 26
15014853 348172 2 fput_light file.h 26
209258 205 0 fput_light file.h 26
1364164 0 0 fput_light file.h 26Which gives 1032903812 times it was correct and 6203351846 times it was incorrect, or 85% incorrect.
--- include/linux/file.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/file.h +1 -1
@@ -23,7 +23,7 @@ extern struct file *alloc_file(struct path *, fmode_t mode,static inline void fput_light (struct file *file,int fput_needed) { -if (unlikely (fput_needed)) +if (fput_needed)fput (file); }
Signature · 1 line
1.7.2.3
PATCH 2/2 fs: Remove unlikely() from fget_light()
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
There's an unlikely() in fget_light() that assumes the file ref count will be 1. Running the annotate branch profiler on a desktop that is performing daily tasks (running firefox, evolution, xchat and is also part of a distcc farm), it shows that the ref count is not 1 that often.
correct incorrect % Function File Line ------- --------- - -------- ---- ---- 1035099358 6209599193 85 fget_light file_table.c 315
--- fs/file_table.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/file_table.c +1 -1
@@ -311,7 +311,7 @@ struct file *fget_light(unsigned int fd, int *fput_needed)struct files_struct *files = current->files; *fput_needed =0 ; -if (likely ((atomic_read (&files->count) ==1 ))) { +if (atomic_read (&files->count) ==1 ) { file =fcheck_files (files, fd); }else {rcu_read_lock ();
Signature · 1 line
1.7.2.3