From: Andrea Arcangeli <andrea@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, Olof Johansson <olof@austin.ibm.com>
Subject: [PATCH] .text page fault SMP scalability optimization
Date: Wed, 19 Oct 2005 09:52:55 +0200 [thread overview]
Message-ID: <20051019075255.GB30541@x30.random> (raw)
We had a problem on ppc64 where with more than 4 threads a large system
wouldn't scale well while faulting in the .text (most of the time was
spent in the kernel despite it was an userland compute intensive app).
The reason is the useless overwrite of the same pte from all cpu.
I fixed it this way (verified on an older kernel but the forward port is
almost identical). This will benefit all archs not just ppc64.
Thanks.
From: Andrea Arcangeli <andrea@suse.de>
Subject: make the .text parallel fault from multiple threads scale in smp
Signed-off-by: Andrea Arcangeli <andrea@suse.de>
memory.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
Index: linux-2.6/mm/memory.c
--- linux-2.6/mm/memory.c.~1~ 2005-09-21 17:38:48.000000000 +0200
+++ linux-2.6/mm/memory.c 2005-10-18 14:20:25.000000000 +0200
@@ -2000,7 +2000,7 @@ static inline int handle_pte_fault(struc
struct vm_area_struct * vma, unsigned long address,
int write_access, pte_t *pte, pmd_t *pmd)
{
- pte_t entry;
+ pte_t entry, young_entry;
entry = *pte;
if (!pte_present(entry)) {
@@ -2021,10 +2021,12 @@ static inline int handle_pte_fault(struc
return do_wp_page(mm, vma, address, pte, pmd, entry);
entry = pte_mkdirty(entry);
}
- entry = pte_mkyoung(entry);
- ptep_set_access_flags(vma, address, pte, entry, write_access);
- update_mmu_cache(vma, address, entry);
- lazy_mmu_prot_update(entry);
+ young_entry = pte_mkyoung(entry);
+ if (!pte_same(young_entry, entry)) {
+ ptep_set_access_flags(vma, address, pte, young_entry, write_access);
+ update_mmu_cache(vma, address, young_entry);
+ lazy_mmu_prot_update(young_entry);
+ }
pte_unmap(pte);
spin_unlock(&mm->page_table_lock);
return VM_FAULT_MINOR;
next reply other threads:[~2005-10-19 7:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-19 7:52 Andrea Arcangeli [this message]
2005-10-19 8:14 ` [PATCH] .text page fault SMP scalability optimization Andrew Morton
2005-10-19 9:06 ` Andrea Arcangeli
2005-10-30 6:17 ` Benjamin Herrenschmidt
2005-10-30 14:44 ` Andrea Arcangeli
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=20051019075255.GB30541@x30.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olof@austin.ibm.com \
/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