aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2016-08-19 08:19:30 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-24 09:04:48 -0400
commit39457acda9139bb078d1b8f974651a194a397060 (patch)
tree0cca90b5a8f3a511d3edbc01f691ff5a168e3571
parented0bd721c9322e8e6ee953884706080d40106a6e (diff)
crypto: xor - skip speed test if the xor function is selected automatically
If the architecture selected the xor function with XOR_SELECT_TEMPLATE the speed result of the do_xor_speed benchmark is of limited value. The speed measurement increases the bootup time a little, which can makes a difference for kernels used in container like virtual machines. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/xor.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/crypto/xor.c b/crypto/xor.c
index 35d6b3adf230..b8975d92cd94 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -109,6 +109,18 @@ calibrate_xor_blocks(void)
109 void *b1, *b2; 109 void *b1, *b2;
110 struct xor_block_template *f, *fastest; 110 struct xor_block_template *f, *fastest;
111 111
112 fastest = NULL;
113
114#ifdef XOR_SELECT_TEMPLATE
115 fastest = XOR_SELECT_TEMPLATE(fastest);
116 if (fastest) {
117 printk(KERN_INFO "xor: automatically using best "
118 "checksumming function %-10s\n",
119 fastest->name);
120 goto out;
121 }
122#endif
123
112 /* 124 /*
113 * Note: Since the memory is not actually used for _anything_ but to 125 * Note: Since the memory is not actually used for _anything_ but to
114 * test the XOR speed, we don't really want kmemcheck to warn about 126 * test the XOR speed, we don't really want kmemcheck to warn about
@@ -126,36 +138,22 @@ calibrate_xor_blocks(void)
126 * all the possible functions, just test the best one 138 * all the possible functions, just test the best one
127 */ 139 */
128 140
129 fastest = NULL;
130
131#ifdef XOR_SELECT_TEMPLATE
132 fastest = XOR_SELECT_TEMPLATE(fastest);
133#endif
134
135#define xor_speed(templ) do_xor_speed((templ), b1, b2) 141#define xor_speed(templ) do_xor_speed((templ), b1, b2)
136 142
137 if (fastest) { 143 printk(KERN_INFO "xor: measuring software checksum speed\n");
138 printk(KERN_INFO "xor: automatically using best " 144 XOR_TRY_TEMPLATES;
139 "checksumming function:\n"); 145 fastest = template_list;
140 xor_speed(fastest); 146 for (f = fastest; f; f = f->next)
141 goto out; 147 if (f->speed > fastest->speed)
142 } else { 148 fastest = f;
143 printk(KERN_INFO "xor: measuring software checksum speed\n");
144 XOR_TRY_TEMPLATES;
145 fastest = template_list;
146 for (f = fastest; f; f = f->next)
147 if (f->speed > fastest->speed)
148 fastest = f;
149 }
150 149
151 printk(KERN_INFO "xor: using function: %s (%d.%03d MB/sec)\n", 150 printk(KERN_INFO "xor: using function: %s (%d.%03d MB/sec)\n",
152 fastest->name, fastest->speed / 1000, fastest->speed % 1000); 151 fastest->name, fastest->speed / 1000, fastest->speed % 1000);
153 152
154#undef xor_speed 153#undef xor_speed
155 154
156 out:
157 free_pages((unsigned long)b1, 2); 155 free_pages((unsigned long)b1, 2);
158 156out:
159 active_template = fastest; 157 active_template = fastest;
160 return 0; 158 return 0;
161} 159}