summaryrefslogtreecommitdiffstats
path: root/crypto/scatterwalk.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-06-01 10:22:03 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-03 04:51:25 +0200
commit160544075f2a4028209721723a51f16add7b08b9 (patch)
tree06a0f03134acaf222ed0b23a47d2a1e40cdd7808 /crypto/scatterwalk.c
parentcrypto: aesni - Convert rfc4106 to new AEAD interface (diff)
downloadlinux-160544075f2a4028209721723a51f16add7b08b9.tar.xz
linux-160544075f2a4028209721723a51f16add7b08b9.zip
crypto: scatterwalk - Hide PageSlab call to optimise away flush_dcache_page
On architectures where flush_dcache_page is not needed, we will end up generating all the code up to the PageSlab call. This is because PageSlab operates on a volatile pointer and thus cannot be optimised away. This patch works around this by checking whether flush_dcache_page is needed before we call PageSlab which then allows PageSlab to be compiled awy. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r--crypto/scatterwalk.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 2ef9cbbc5dbf..ea5815c5e128 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -54,7 +54,11 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
struct page *page;
page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT);
- if (!PageSlab(page))
+ /* Test ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE first as
+ * PageSlab cannot be optimised away per se due to
+ * use of volatile pointer.
+ */
+ if (ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE && !PageSlab(page))
flush_dcache_page(page);
}