x86: fix boot failure on 486 due to TSC breakage
[sfrench/cifs-2.6.git] / kernel / rcutorture.c
index 55ba82a85a66c65605994ec685a2ce1918efdfc9..fd599829e72a5d49a5852272ba234be8c38accaf 100644 (file)
 #include <linux/sched.h>
 #include <asm/atomic.h>
 #include <linux/bitops.h>
-#include <linux/module.h>
 #include <linux/completion.h>
 #include <linux/moduleparam.h>
 #include <linux/percpu.h>
 #include <linux/notifier.h>
+#include <linux/freezer.h>
 #include <linux/cpu.h>
-#include <linux/random.h>
 #include <linux/delay.h>
 #include <linux/byteorder/swabb.h>
 #include <linux/stat.h>
@@ -165,16 +164,14 @@ struct rcu_random_state {
 
 /*
  * Crude but fast random-number generator.  Uses a linear congruential
- * generator, with occasional help from get_random_bytes().
+ * generator, with occasional help from cpu_clock().
  */
 static unsigned long
 rcu_random(struct rcu_random_state *rrsp)
 {
-       long refresh;
-
        if (--rrsp->rrs_count < 0) {
-               get_random_bytes(&refresh, sizeof(refresh));
-               rrsp->rrs_state += refresh;
+               rrsp->rrs_state +=
+                       (unsigned long)cpu_clock(raw_smp_processor_id());
                rrsp->rrs_count = RCU_RANDOM_REFRESH;
        }
        rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD;
@@ -518,7 +515,6 @@ rcu_torture_writer(void *arg)
 
        VERBOSE_PRINTK_STRING("rcu_torture_writer task started");
        set_user_nice(current, 19);
-       current->flags |= PF_NOFREEZE;
 
        do {
                schedule_timeout_uninterruptible(1);
@@ -558,7 +554,6 @@ rcu_torture_fakewriter(void *arg)
 
        VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task started");
        set_user_nice(current, 19);
-       current->flags |= PF_NOFREEZE;
 
        do {
                schedule_timeout_uninterruptible(1 + rcu_random(&rand)%10);
@@ -589,7 +584,6 @@ rcu_torture_reader(void *arg)
 
        VERBOSE_PRINTK_STRING("rcu_torture_reader task started");
        set_user_nice(current, 19);
-       current->flags |= PF_NOFREEZE;
 
        do {
                idx = cur_ops->readlock();
@@ -732,11 +726,11 @@ static void rcu_torture_shuffle_tasks(void)
        cpumask_t tmp_mask = CPU_MASK_ALL;
        int i;
 
-       lock_cpu_hotplug();
+       get_online_cpus();
 
        /* No point in shuffling if there is only one online CPU (ex: UP) */
        if (num_online_cpus() == 1) {
-               unlock_cpu_hotplug();
+               put_online_cpus();
                return;
        }
 
@@ -768,7 +762,7 @@ static void rcu_torture_shuffle_tasks(void)
        else
                rcu_idle_cpu--;
 
-       unlock_cpu_hotplug();
+       put_online_cpus();
 }
 
 /* Shuffle tasks across CPUs, with the intent of allowing each CPU in the