From: Arjan van de Ven <arjan@intel.linux.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, ak@suse.de
Subject: [Patch 1/3] prefetch the mmap_sem in the fault path
Date: Thu, 23 Feb 2006 10:30:07 +0100 [thread overview]
Message-ID: <1140687007.4672.6.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1140686152.2972.25.camel@laptopd505.fenrus.org>
In a micro-benchmark that stresses the pagefault path, the down_read_trylock
on the mmap_sem showed up quite high on the profile. Turns out this lock is
bouncing between cpus quite a bit and thus is cache-cold a lot. This patch
prefetches the lock (for write) as early as possible (and before some other
somewhat expensive operations). With this patch, the down_read_trylock
basically fell out of the top of profile.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
arch/x86_64/mm/fault.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-work/arch/x86_64/mm/fault.c
===================================================================
--- linux-work.orig/arch/x86_64/mm/fault.c
+++ linux-work/arch/x86_64/mm/fault.c
@@ -312,6 +312,10 @@ asmlinkage void __kprobes do_page_fault(
unsigned long flags;
siginfo_t info;
+ tsk = current;
+ mm = tsk->mm;
+ prefetchw(&mm->mmap_sem);
+
/* get the address */
__asm__("movq %%cr2,%0":"=r" (address));
if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
@@ -325,8 +329,6 @@ asmlinkage void __kprobes do_page_fault(
printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n",
regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code);
- tsk = current;
- mm = tsk->mm;
info.si_code = SEGV_MAPERR;
next parent reply other threads:[~2006-02-23 9:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1140686152.2972.25.camel@laptopd505.fenrus.org>
2006-02-23 9:30 ` Arjan van de Ven [this message]
2006-02-23 9:39 ` Andi Kleen
2006-02-23 9:47 ` Arjan van de Ven
2006-02-23 10:14 ` Andi Kleen
2006-02-23 12:29 ` Jes Sorensen
2006-02-23 12:39 ` Arjan van de Ven
2006-02-23 4:15 ` Ray Bryant
2006-03-01 0:51 Valerie Henson
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=1140687007.4672.6.camel@laptopd505.fenrus.org \
--to=arjan@intel.linux.com \
--cc=ak@suse.de \
--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®