From: Nikita Danilov <nikita@clusterfs.com>
To: Linux Kernel Mailing List <Linux-Kernel@vger.kernel.org>
Cc: Andrew Morton <AKPM@Osdl.ORG>
Subject: [PATCH]: find_lock_page(): call __lock_page() directly.
Date: Wed, 23 Nov 2005 18:24:38 +0300 [thread overview]
Message-ID: <17284.35254.577998.442784@gargle.gargle.HOWL> (raw)
Hello,
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.
Andrew, please apply.
Nikita.
Signed-off-by: Nikita Danilov <danilov@gmail.com>
mm/filemap.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff -puN mm/filemap.c~find_lock_page-use-__lock_page mm/filemap.c
--- git-linux/mm/filemap.c~find_lock_page-use-__lock_page 2005-11-20 16:33:58.000000000 +0300
+++ git-linux-nikita/mm/filemap.c 2005-11-20 16:41:46.000000000 +0300
@@ -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;
_
reply other threads:[~2005-11-23 15:28 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=17284.35254.577998.442784@gargle.gargle.HOWL \
--to=nikita@clusterfs.com \
--cc=AKPM@Osdl.ORG \
--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®