summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorNikita Danilov <nikita@clusterfs.com>2006-01-06 00:11:08 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 08:33:26 -0800
commitbbfbb7cec9dd7266534b2b4b9c8be2fa425bbfc9 (patch)
treed1949123224d1674a7192743d188ff652c964663 /mm
parenta226f6c899799fe2c4919daa0767ac579c88f7bd (diff)
[PATCH] find_lock_page(): call __lock_page() directly.
As find_lock_page() already checks with TestSetPageLocked() that page is locked, there is no need to call lock_page() that will try-lock page again (chances of page being unlocked in between are small). Call __lock_page() directly, this saves one atomic operation. Also, mark truncate-while-slept path as unlikely while we are here. (akpm: ug. But this is actually a common path for normal old read()s against a page which is under readahead I/O so ho-hum.) Signed-off-by: Nikita Danilov <danilov@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 6e1d08a2b8b..4ef24a39768 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -555,11 +555,12 @@ repeat:
page_cache_get(page);
if (TestSetPageLocked(page)) {
read_unlock_irq(&mapping->tree_lock);
- lock_page(page);
+ __lock_page(page);
read_lock_irq(&mapping->tree_lock);
/* Has the page been truncated while we slept? */
- if (page->mapping != mapping || page->index != offset) {
+ if (unlikely(page->mapping != mapping ||
+ page->index != offset)) {
unlock_page(page);
page_cache_release(page);
goto repeat;