Skip to contentSkip to conversation

RFC: 2 pages are enough for xor speed testing

PATCH Amos Kong 2 participants 3 messages May 28, 2014 – Jun 5, 2014 Crypto API

lore
Share & tools
lore

Amos Kong

author
#0 lore 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.

crypto/xor.c +3 -3
index 35d6b3a..38421a1 100644
@@ -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;
#1 lore raw

crypto/xor.c calibrate_xor_blocks(void) · line 160

Quoted 9 lines · Amos Kong
crypto/xor.c +1 -1
@@ -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

author
#2 lore raw
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Amos Kong
crypto/xor.c +0 -0
@@ -154,7 +154,7 @@ calibrate_xor_blocks(void)
 #undef xor_speed
 
Quoted 8 lines

crypto/xor.c calibrate_xor_blocks(void) · line 160

Quoted 6 lines
crypto/xor.c +1 -1
  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!

Quoted 2 lines

Best regards,
Marek Vasut

Signature · 1 line
			Amos.