linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: 2 pages are enough for xor speed testing
@ 2014-05-28  5:01 Amos Kong
  2014-06-01 16:53 ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Amos Kong @ 2014-05-28  5:01 UTC (permalink / raw)
  To: herbert, davem; +Cc: linux-crypto

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: RFC: 2 pages are enough for xor speed testing
  2014-05-28  5:01 RFC: 2 pages are enough for xor speed testing Amos Kong
@ 2014-06-01 16:53 ` Marek Vasut
  2014-06-05  1:07   ` Amos Kong
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2014-06-01 16:53 UTC (permalink / raw)
  To: Amos Kong; +Cc: herbert, davem, linux-crypto

On Wednesday, May 28, 2014 at 07:01:52 AM, Amos Kong wrote:
> @@ -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;

I suppose this part of the patch was not intentional ;-)

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: 2 pages are enough for xor speed testing
  2014-06-01 16:53 ` Marek Vasut
@ 2014-06-05  1:07   ` Amos Kong
  0 siblings, 0 replies; 3+ messages in thread
From: Amos Kong @ 2014-06-05  1:07 UTC (permalink / raw)
  To: Marek Vasut; +Cc: herbert, davem, linux-crypto

On Sun, Jun 01, 2014 at 06:53:31PM +0200, Marek Vasut wrote:
> On Wednesday, May 28, 2014 at 07:01:52 AM, Amos Kong wrote:
> > @@ -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;
> 
> I suppose this part of the patch was not intentional ;-)

Sorry, I changed this to know if code was built.

I will post a new version, thanks!
 
> Best regards,
> Marek Vasut

-- 
			Amos.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-05  1:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28  5:01 RFC: 2 pages are enough for xor speed testing Amos Kong
2014-06-01 16:53 ` Marek Vasut
2014-06-05  1:07   ` Amos Kong

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).