Skip to content

Commit

Permalink
crypto: disable preemption while benchmarking RAID5 xor checksumming
Browse files Browse the repository at this point in the history
With CONFIG_PREEMPT=y, we need to disable preemption while benchmarking
RAID5 xor checksumming to ensure we're actually measuring what we think
we're measuring.

Signed-off-by: Jim Kukunas <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
jtkukunas authored and neilbrown committed May 22, 2012
1 parent 6a32847 commit 56a5199
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crypto/xor.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/gfp.h>
#include <linux/raid/xor.h>
#include <linux/jiffies.h>
#include <linux/preempt.h>
#include <asm/xor.h>

/* The xor routines to use. */
Expand Down Expand Up @@ -69,6 +70,8 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
tmpl->next = template_list;
template_list = tmpl;

preempt_disable();

/*
* Count the number of XORs done during a whole jiffy, and use
* this to calculate the speed of checksumming. We use a 2-page
Expand All @@ -91,6 +94,8 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
max = count;
}

preempt_enable();

speed = max * (HZ * BENCH_SIZE / 1024);
tmpl->speed = speed;

Expand Down

0 comments on commit 56a5199

Please sign in to comment.