All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: herbert@gondor.apana.org.au, davem@davemloft.net
Cc: linux-crypto@vger.kernel.org
Subject: RFC: 2 pages are enough for xor speed testing
Date: Wed, 28 May 2014 13:01:52 +0800	[thread overview]
Message-ID: <20140528050152.GA2948@z.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. Why do we skip 2 pages
when we set *b2?

It seems that total 2 pages are enough.

diff --git a/crypto/xor.c b/crypto/xor.c
index 35d6b3a..38421a1 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_pssssages((unsigned long)b1, 1);
 
 	active_template = fastest;
 	return 0;

             reply	other threads:[~2014-05-28  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28  5:01 Amos Kong [this message]
2014-06-01 16:53 ` RFC: 2 pages are enough for xor speed testing Marek Vasut
2014-06-05  1:07   ` Amos Kong

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=20140528050152.GA2948@z.redhat.com \
    --to=akong@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.