mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: peterz@infradead.org
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 3/4] x86: Optimize enhanced copy user fault handling
Date: Fri, 10 Oct 2014 16:25:16 -0700	[thread overview]
Message-ID: <1412983517-12419-4-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1412983517-12419-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

For the enhanced copy string case we can trivially optimize the fault
handling. It is just a single subtraction, as there is only one
possible fault point. So get rid of handle tail for this and
just do the subtraction directly.

This patch is strictly not needed for the goal of making perf
backtrace faster, but it will possibly help other workloads.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/lib/copy_user_64.S | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S
index dee945d..608caf45 100644
--- a/arch/x86/lib/copy_user_64.S
+++ b/arch/x86/lib/copy_user_64.S
@@ -285,8 +285,10 @@ ENTRY(copy_user_enhanced_fast_string)
 	ret
 
 	.section .fixup,"ax"
-12:	movl %ecx,%edx		/* ecx is zerorest also */
-	jmp copy_user_handle_tail
+	/* edx: len: ecx: actually copied bytes */
+12:	sub  %ecx,%edx
+	mov %edx,%eax
+	ret
 	.previous
 
 	_ASM_EXTABLE(1b,12b)
-- 
1.9.3


  parent reply	other threads:[~2014-10-10 23:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10 23:25 Updated perf backtrace improvement patchkit Andi Kleen
2014-10-10 23:25 ` [PATCH 1/4] Move pagefault_enable/disable to own include file Andi Kleen
2014-10-10 23:25 ` [PATCH 2/4] x86: Move copy_from_user_nmi() inline Andi Kleen
2014-10-10 23:25 ` Andi Kleen [this message]
2014-10-10 23:25 ` [PATCH 4/4] x86: Use the page tables to look up kernel addresses in backtrace Andi Kleen
2014-10-11  0:24   ` Chuck Ebbert
2014-10-11  0:33   ` Eric Dumazet

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=1412983517-12419-4-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@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®