linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] x86: support REP MOVSB copy_page()
Date: Tue, 23 Aug 2016 19:25:33 +0300	[thread overview]
Message-ID: <20160823162533.GB2286@p183.telecom.by> (raw)
In-Reply-To: <20160823161920.GA2286@p183.telecom.by>

Microbenchmark shows that "REP MOVSB" copy_page() is faster
than "REP MOVSQ" version on Intel i5-something Haswell
REP_GOOD/ERMS capable CPU.

N=1<<27
rep movsq:	6.758841901 ± 0.04%
rep movsb:	6.253927309 ± 0.02%
-----------------------------------
			-7.5%

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 arch/x86/lib/copy_page_64.S |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/arch/x86/lib/copy_page_64.S
+++ b/arch/x86/lib/copy_page_64.S
@@ -12,12 +12,21 @@
  */
 	ALIGN
 ENTRY(copy_page)
-	ALTERNATIVE "jmp copy_page_regs", "", X86_FEATURE_REP_GOOD
+	ALTERNATIVE_2 "jmp copy_page_regs",	\
+		"", X86_FEATURE_REP_GOOD,	\
+		"jmp copy_page_rep_movsb", X86_FEATURE_ERMS
+
 	movl	$4096/8, %ecx
 	rep	movsq
 	ret
 ENDPROC(copy_page)
 
+ENTRY(copy_page_rep_movsb)
+	mov	$4096, %ecx
+	rep movsb
+	ret
+ENDPROC(copy_page_rep_movsb)
+
 ENTRY(copy_page_regs)
 	subq	$2*8,	%rsp
 	movq	%rbx,	(%rsp)

  reply	other threads:[~2016-08-23 16:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22 20:52 [PATCH] x86: branchless clear_page() Alexey Dobriyan
2016-08-22 20:54 ` Alexey Dobriyan
2016-08-22 21:06 ` Borislav Petkov
2016-08-23 10:46   ` Alexey Dobriyan
2016-08-23 13:43 ` Brian Gerst
2016-08-23 16:15   ` Alexey Dobriyan
2016-08-23 16:19 ` [PATCH 1/3] " Alexey Dobriyan
2016-08-23 16:25   ` Alexey Dobriyan [this message]
2016-08-23 16:28     ` [PATCH 3/3] x86: branchless copy_page() Alexey Dobriyan

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=20160823162533.GB2286@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).