mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-06 04:14:13 +08:00
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>
This commit is contained in:
parent
3ea7daa5d7
commit
6a328475cc
@ -63,7 +63,7 @@ static void
|
|||||||
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
|
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
|
||||||
{
|
{
|
||||||
int speed;
|
int speed;
|
||||||
unsigned long now;
|
unsigned long now, j;
|
||||||
int i, count, max;
|
int i, count, max;
|
||||||
|
|
||||||
tmpl->next = template_list;
|
tmpl->next = template_list;
|
||||||
@ -76,9 +76,11 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
|
|||||||
*/
|
*/
|
||||||
max = 0;
|
max = 0;
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
now = jiffies;
|
j = jiffies;
|
||||||
count = 0;
|
count = 0;
|
||||||
while (jiffies == now) {
|
while ((now = jiffies) == j)
|
||||||
|
cpu_relax();
|
||||||
|
while (time_before(jiffies, now + 1)) {
|
||||||
mb(); /* prevent loop optimzation */
|
mb(); /* prevent loop optimzation */
|
||||||
tmpl->do_2(BENCH_SIZE, b1, b2);
|
tmpl->do_2(BENCH_SIZE, b1, b2);
|
||||||
mb();
|
mb();
|
||||||
|
Loading…
Reference in New Issue
Block a user