linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org
Subject: [patch 3/3] powerpc: Preload application text segment instead of TASK_UNMAPPED_BASE
Date: Tue, 14 Jul 2009 16:53:53 +1000	[thread overview]
Message-ID: <20090714065425.555222245@samba.org> (raw)
In-Reply-To: 20090714065350.659537380@samba.org

TASK_UNMAPPED_BASE is not used with the new top down mmap layout. We can
reuse this preload slot by loading in the segment at 0x10000000, where almost
all PowerPC binaries are linked at.

On a microbenchmark that bounces a token between two 64bit processes over pipes
and calls gettimeofday each iteration (to access the VDSO), both the 32bit and
64bit context switch rate improves (tested on a 4GHz POWER6):

32bit: 273k/sec -> 283k/sec
64bit: 277k/sec -> 284k/sec

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux.trees.git/arch/powerpc/mm/slb.c
===================================================================
--- linux.trees.git.orig/arch/powerpc/mm/slb.c	2009-07-14 15:09:39.000000000 +1000
+++ linux.trees.git/arch/powerpc/mm/slb.c	2009-07-14 15:12:42.000000000 +1000
@@ -191,7 +191,7 @@
 	unsigned long slbie_data = 0;
 	unsigned long pc = KSTK_EIP(tsk);
 	unsigned long stack = KSTK_ESP(tsk);
-	unsigned long unmapped_base;
+	unsigned long exec_base;
 
 	if (!cpu_has_feature(CPU_FTR_NO_SLBIE_B) &&
 	    offset <= SLB_CACHE_ENTRIES) {
@@ -219,14 +219,13 @@
 
 	/*
 	 * preload some userspace segments into the SLB.
+	 * Almost all 32 and 64bit PowerPC executables are linked at
+	 * 0x10000000 so it makes sense to preload this segment.
 	 */
-	if (test_tsk_thread_flag(tsk, TIF_32BIT))
-		unmapped_base = TASK_UNMAPPED_BASE_USER32;
-	else
-		unmapped_base = TASK_UNMAPPED_BASE_USER64;
+	exec_base = 0x10000000;
 
 	if (is_kernel_addr(pc) || is_kernel_addr(stack) ||
-	    is_kernel_addr(unmapped_base))
+	    is_kernel_addr(exec_base))
 		return;
 
 	slb_allocate(pc);
@@ -234,9 +233,9 @@
 	if (!esids_match(pc, stack))
 		slb_allocate(stack);
 
-	if (!esids_match(pc, unmapped_base) &&
-	    !esids_match(stack, unmapped_base))
-		slb_allocate(unmapped_base);
+	if (!esids_match(pc, exec_base) &&
+	    !esids_match(stack, exec_base))
+		slb_allocate(exec_base);
 }
 
 static inline void patch_slb_encoding(unsigned int *insn_addr,

-- 

  parent reply	other threads:[~2009-07-14  7:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14  6:53 [patch 0/3] PowerPC context switch optimisations Anton Blanchard
2009-07-14  6:53 ` [patch 1/3] powerpc: Move 64bit VDSO to improve context switch performance Anton Blanchard
2009-07-14  7:07   ` Benjamin Herrenschmidt
2009-07-14  7:38     ` Anton Blanchard
2009-10-02 19:14   ` Andreas Schwab
     [not found]   ` <m2ocophale.fsf__34527.2158309401$1254511503$gmane$org@igel.home>
2009-10-03 14:15     ` Andreas Schwab
2009-10-03 14:51       ` Andreas Schwab
2009-10-03 21:53         ` Benjamin Herrenschmidt
2009-10-04 12:35           ` Andreas Schwab
2009-07-14  6:53 ` [patch 2/3] powerpc: Rearrange SLB preload code Anton Blanchard
2009-07-14  6:53 ` Anton Blanchard [this message]
2009-07-14  7:10   ` [patch 3/3] powerpc: Preload application text segment instead of TASK_UNMAPPED_BASE Benjamin Herrenschmidt
2009-07-14  7:27     ` Anton Blanchard

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=20090714065425.555222245@samba.org \
    --to=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).