diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-01-13 18:46:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:36 -0500 |
commit | c585a2678d83ba8fb02fa6b197de0ac7d67377f1 (patch) | |
tree | b722f3c6fa28d1228e34adbcb85fee8683b34069 /mm/filemap.c | |
parent | e20e87795834f2f14cb53baf657b91d9c39f92c8 (diff) |
mm: remove likely() from grab_cache_page_write_begin()
Running the annotated branch profiler on a box doing average work
(firefox, evolution, xchat, distcc farm), the likely() used in
grab_cache_page_write_begin() was incorrect most of the time:
correct incorrect % Function File Line
------- --------- - -------- ---- ----
1924262 71332401 97 grab_cache_page_write_begin filemap.c 2206
Adding a trace_printk() and running the function tracer limited to
just this function I can see:
gconfd-2-2696 [000] 4467.268935: grab_cache_page_write_begin: page= (null) mapping=ffff8800676a9460 index=7
gconfd-2-2696 [000] 4467.268946: grab_cache_page_write_begin <-ext3_write_begin
gconfd-2-2696 [000] 4467.268947: grab_cache_page_write_begin: page= (null) mapping=ffff8800676a9460 index=8
gconfd-2-2696 [000] 4467.268959: grab_cache_page_write_begin <-ext3_write_begin
gconfd-2-2696 [000] 4467.268960: grab_cache_page_write_begin: page= (null) mapping=ffff8800676a9460 index=9
gconfd-2-2696 [000] 4467.268972: grab_cache_page_write_begin <-ext3_write_begin
gconfd-2-2696 [000] 4467.268973: grab_cache_page_write_begin: page= (null) mapping=ffff8800676a9460 index=10
gconfd-2-2696 [000] 4467.268991: grab_cache_page_write_begin <-ext3_write_begin
gconfd-2-2696 [000] 4467.268992: grab_cache_page_write_begin: page= (null) mapping=ffff8800676a9460 index=11
gconfd-2-2696 [000] 4467.269005: grab_cache_page_write_begin <-ext3_write_begin
Which shows that a lot of calls from ext3_write_begin will result in the
page returned by "find_lock_page" will be NULL.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Nick Piggin <npiggin@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index b4ad8e36c81a..83a45d35468b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2227,7 +2227,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, | |||
2227 | gfp_notmask = __GFP_FS; | 2227 | gfp_notmask = __GFP_FS; |
2228 | repeat: | 2228 | repeat: |
2229 | page = find_lock_page(mapping, index); | 2229 | page = find_lock_page(mapping, index); |
2230 | if (likely(page)) | 2230 | if (page) |
2231 | return page; | 2231 | return page; |
2232 | 2232 | ||
2233 | page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); | 2233 | page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); |