From: Andrew Pinski <apinski@cavium.com>
To: pinskia@gmail.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Will Deacon <will.deacon@arm.com>
Cc: Andrew Pinski <apinski@cavium.com>
Subject: [PATCH 4/5] ARM64: Patch in prefetching for copy_page is requested
Date: Tue, 12 Jan 2016 23:08:18 -0800 [thread overview]
Message-ID: <1452668899-3553-5-git-send-email-apinski@cavium.com> (raw)
In-Reply-To: <1452668899-3553-1-git-send-email-apinski@cavium.com>
On ThunderX T88 pass 1 and pass 2, there is no
hardware prefetching so we need to patch in
software prefetching. Prefetching improves this code
by 60% over the original code and 2x over the code
without prefetching.
Meaured by using the benchmark code at
https://github.com/apinski-cavium/copy_page_benchmark
Signed-off-by: Andrew Pinski <apinski@cavium.com>
---
arch/arm64/lib/copy_page.S | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/arm64/lib/copy_page.S b/arch/arm64/lib/copy_page.S
index dfb0316..876e882 100644
--- a/arch/arm64/lib/copy_page.S
+++ b/arch/arm64/lib/copy_page.S
@@ -18,6 +18,8 @@
#include <linux/const.h>
#include <asm/assembler.h>
#include <asm/page.h>
+#include <asm/cpufeature.h>
+#include <asm/alternative.h>
/*
@@ -28,6 +30,15 @@
* x1 - src
*/
ENTRY(copy_page)
+alternative_if_not ARM64_NEEDS_PREFETCH_128
+ nop
+ nop
+alternative_else
+ # Prefetch two cache lines ahead.
+ prfm pldl1strm, [x1, #128]
+ prfm pldl1strm, [x1, #256]
+alternative_endif
+
ldp x2, x3, [x1]
ldp x4, x5, [x1, #16]
ldp x6, x7, [x1, #32]
@@ -42,6 +53,12 @@ ENTRY(copy_page)
1:
subs x18, x18, #128
+alternative_if_not ARM64_NEEDS_PREFETCH_128
+ nop
+alternative_else
+ prfm pldl1strm, [x1, #384]
+alternative_endif
+
stnp x2, x3, [x0]
ldp x2, x3, [x1]
stnp x4, x5, [x0, #16]
--
1.7.2.5
next prev parent reply other threads:[~2016-01-13 7:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 7:08 [PATCHv2 0/4] ARM64: Improve copy_page and copy_template for ThunderX Andrew Pinski
2016-01-13 7:08 ` [PATCH 1/5] ARM64: Support midr detected cpufeature Andrew Pinski
2016-01-13 7:08 ` [PATCH 2/5] ARM64 Improve copy_page for 128 byte cache line Andrew Pinski
2016-01-13 7:08 ` [PATCH 3/5] ARM64: Add Needs software prefetching cap Andrew Pinski
2016-01-13 7:08 ` Andrew Pinski [this message]
2016-01-13 7:08 ` [PATCH 5/5] ARM64: Patch in prefetching in copy_template Andrew Pinski
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=1452668899-3553-5-git-send-email-apinski@cavium.com \
--to=apinski@cavium.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pinskia@gmail.com \
--cc=will.deacon@arm.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
all inboxes | Powered by JetHome®