git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'module-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty...
[pandora-kernel.git]
/
crypto
/
xor.c
diff --git
a/crypto/xor.c
b/crypto/xor.c
index
b75182d
..
65c7b41
100644
(file)
--- a/
crypto/xor.c
+++ b/
crypto/xor.c
@@
-21,6
+21,7
@@
#include <linux/gfp.h>
#include <linux/raid/xor.h>
#include <linux/jiffies.h>
#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. */
#include <asm/xor.h>
/* The xor routines to use. */
@@
-63,12
+64,14
@@
static void
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
{
int speed;
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
{
int speed;
- unsigned long now;
+ unsigned long now
, j
;
int i, count, max;
tmpl->next = template_list;
template_list = tmpl;
int i, count, max;
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
/*
* Count the number of XORs done during a whole jiffy, and use
* this to calculate the speed of checksumming. We use a 2-page
@@
-76,9
+79,11
@@
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
*/
max = 0;
for (i = 0; i < 5; i++) {
*/
max = 0;
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 */
tmpl->do_2(BENCH_SIZE, b1, b2);
mb();
mb(); /* prevent loop optimzation */
tmpl->do_2(BENCH_SIZE, b1, b2);
mb();
@@
-89,6
+94,8
@@
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
max = count;
}
max = count;
}
+ preempt_enable();
+
speed = max * (HZ * BENCH_SIZE / 1024);
tmpl->speed = speed;
speed = max * (HZ * BENCH_SIZE / 1024);
tmpl->speed = speed;
@@
-129,9
+136,9
@@
calibrate_xor_blocks(void)
if (fastest) {
printk(KERN_INFO "xor: automatically using best "
if (fastest) {
printk(KERN_INFO "xor: automatically using best "
- "checksumming function: %s\n",
- fastest->name);
+ "checksumming function:\n");
xor_speed(fastest);
xor_speed(fastest);
+ goto out;
} else {
printk(KERN_INFO "xor: measuring software checksum speed\n");
XOR_TRY_TEMPLATES;
} else {
printk(KERN_INFO "xor: measuring software checksum speed\n");
XOR_TRY_TEMPLATES;
@@
-146,6
+153,7
@@
calibrate_xor_blocks(void)
#undef xor_speed
#undef xor_speed
+ out:
free_pages((unsigned long)b1, 2);
active_template = fastest;
free_pages((unsigned long)b1, 2);
active_template = fastest;