linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au, davem@davemloft.net, marex@denx.de
Subject: [PATCH] crypto/xor.c: use 2 pages for xor speed testing
Date: Thu,  5 Jun 2014 09:11:33 +0800	[thread overview]
Message-ID: <1401930693-6549-1-git-send-email-akong@redhat.com> (raw)

In crypto/xor.c: calibrate_xor_blocks(), we allocated total 4 pages to
do xor speed testing, the BENCH_SIZE is 1 page, and we skipped 2 pages
when we set b2.

It seems that total 2 pages are enough without skipping 2 pages.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 crypto/xor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/xor.c b/crypto/xor.c
index 35d6b3a..609dfb5 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -114,12 +114,12 @@ calibrate_xor_blocks(void)
 	 * test the XOR speed, we don't really want kmemcheck to warn about
 	 * reading uninitialized bytes here.
 	 */
-	b1 = (void *) __get_free_pages(GFP_KERNEL | __GFP_NOTRACK, 2);
+	b1 = (void *) __get_free_pages(GFP_KERNEL | __GFP_NOTRACK, 1);
 	if (!b1) {
 		printk(KERN_WARNING "xor: Yikes!  No memory available.\n");
 		return -ENOMEM;
 	}
-	b2 = b1 + 2*PAGE_SIZE + BENCH_SIZE;
+	b2 = b1 + BENCH_SIZE;
 
 	/*
 	 * If this arch/cpu has a short-circuited selection, don't loop through
@@ -154,7 +154,7 @@ calibrate_xor_blocks(void)
 #undef xor_speed
 
  out:
-	free_pages((unsigned long)b1, 2);
+	free_pages((unsigned long)b1, 1);
 
 	active_template = fastest;
 	return 0;
-- 
1.9.3

             reply	other threads:[~2014-06-05  1:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05  1:11 Amos Kong [this message]
2014-06-05 21:57 ` [PATCH] crypto/xor.c: use 2 pages for xor speed testing Marek Vasut
2014-06-17  7:16   ` Amos Kong
2014-06-25 19:59     ` Marek Vasut

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=1401930693-6549-1-git-send-email-akong@redhat.com \
    --to=akong@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=marex@denx.de \
    /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).