Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[pandora-kernel.git] / kernel / rcutorture.c
index 17cba7a..ddff332 100644 (file)
@@ -40,6 +40,7 @@
 #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>
@@ -502,10 +503,6 @@ static struct rcu_torture_ops sched_ops = {
        .name = "sched"
 };
 
-static struct rcu_torture_ops *torture_ops[] =
-       { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, &srcu_ops,
-         &sched_ops, NULL };
-
 /*
  * RCU torture writer kthread.  Repeatedly substitutes a new structure
  * for that pointed to by rcu_torture_current, freeing the old structure
@@ -522,7 +519,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);
@@ -562,7 +558,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);
@@ -593,7 +588,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();
@@ -872,16 +866,17 @@ rcu_torture_init(void)
        int i;
        int cpu;
        int firsterr = 0;
+       static struct rcu_torture_ops *torture_ops[] =
+               { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops,
+                 &srcu_ops, &sched_ops, };
 
        /* Process args and tell the world that the torturer is on the job. */
-
-       for (i = 0; cur_ops = torture_ops[i], cur_ops; i++) {
+       for (i = 0; i < ARRAY_SIZE(torture_ops); i++) {
                cur_ops = torture_ops[i];
-               if (strcmp(torture_type, cur_ops->name) == 0) {
+               if (strcmp(torture_type, cur_ops->name) == 0)
                        break;
-               }
        }
-       if (cur_ops == NULL) {
+       if (i == ARRAY_SIZE(torture_ops)) {
                printk(KERN_ALERT "rcutorture: invalid torture type: \"%s\"\n",
                       torture_type);
                return (-EINVAL);