aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/xor.c
diff options
context:
space:
mode:
authorJim Kukunas <james.t.kukunas@linux.intel.com>2012-05-21 23:54:03 -0400
committerNeilBrown <neilb@suse.de>2012-05-21 23:54:03 -0400
commit6a328475cccacb99a13b06978091da936dd51d89 (patch)
treef4fc193b5ec71f7c7dfc0a33341d80a2c103c205 /crypto/xor.c
parent3ea7daa5d7fde47cd41f4d56c2deb949114da9d6 (diff)
crypto: wait for a full jiffy in do_xor_speed
In the existing do_xor_speed(), there is no guarantee that we actually run do_2() for a full jiffy. We get the current jiffy, then run do_2() until the next jiffy. Instead, let's get the current jiffy, then wait until the next jiffy to start our test. Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'crypto/xor.c')
-rw-r--r--crypto/xor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/xor.c b/crypto/xor.c
index b75182d8ab14..87884435bddb 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -63,7 +63,7 @@ static void
63do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2) 63do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
64{ 64{
65 int speed; 65 int speed;
66 unsigned long now; 66 unsigned long now, j;
67 int i, count, max; 67 int i, count, max;
68 68
69 tmpl->next = template_list; 69 tmpl->next = template_list;
@@ -76,9 +76,11 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
76 */ 76 */
77 max = 0; 77 max = 0;
78 for (i = 0; i < 5; i++) { 78 for (i = 0; i < 5; i++) {
79 now = jiffies; 79 j = jiffies;
80 count = 0; 80 count = 0;
81 while (jiffies == now) { 81 while ((now = jiffies) == j)
82 cpu_relax();
83 while (time_before(jiffies, now + 1)) {
82 mb(); /* prevent loop optimzation */ 84 mb(); /* prevent loop optimzation */
83 tmpl->do_2(BENCH_SIZE, b1, b2); 85 tmpl->do_2(BENCH_SIZE, b1, b2);
84 mb(); 86 mb();