]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/rcutorture.c
include/linux/compiler.h: reject gcc 3 < gcc 3.2
[linux-2.6-omap-h63xx.git] / kernel / rcutorture.c
index 1c329df60bccf7e1f58f0dc06f07fe39635374ec..c52f981ea0086e569b37c5195cf291c6be55d446 100644 (file)
@@ -370,6 +370,19 @@ static struct rcu_torture_ops rcu_bh_ops = {
        .name = "rcu_bh"
 };
 
+static struct rcu_torture_ops rcu_bh_sync_ops = {
+       .init = rcu_sync_torture_init,
+       .cleanup = NULL,
+       .readlock = rcu_bh_torture_read_lock,
+       .readdelay = rcu_read_delay,  /* just reuse rcu's version. */
+       .readunlock = rcu_bh_torture_read_unlock,
+       .completed = rcu_bh_torture_completed,
+       .deferredfree = rcu_sync_torture_deferred_free,
+       .sync = rcu_bh_torture_synchronize,
+       .stats = NULL,
+       .name = "rcu_bh_sync"
+};
+
 /*
  * Definitions for srcu torture testing.
  */
@@ -388,7 +401,7 @@ static void srcu_torture_cleanup(void)
        cleanup_srcu_struct(&srcu_ctl);
 }
 
-static int srcu_torture_read_lock(void)
+static int srcu_torture_read_lock(void) __acquires(&srcu_ctl)
 {
        return srcu_read_lock(&srcu_ctl);
 }
@@ -406,7 +419,7 @@ static void srcu_read_delay(struct rcu_random_state *rrsp)
                schedule_timeout_interruptible(longdelay);
 }
 
-static void srcu_torture_read_unlock(int idx)
+static void srcu_torture_read_unlock(int idx) __releases(&srcu_ctl)
 {
        srcu_read_unlock(&srcu_ctl, idx);
 }
@@ -451,8 +464,47 @@ static struct rcu_torture_ops srcu_ops = {
        .name = "srcu"
 };
 
+/*
+ * Definitions for sched torture testing.
+ */
+
+static int sched_torture_read_lock(void)
+{
+       preempt_disable();
+       return 0;
+}
+
+static void sched_torture_read_unlock(int idx)
+{
+       preempt_enable();
+}
+
+static int sched_torture_completed(void)
+{
+       return 0;
+}
+
+static void sched_torture_synchronize(void)
+{
+       synchronize_sched();
+}
+
+static struct rcu_torture_ops sched_ops = {
+       .init = rcu_sync_torture_init,
+       .cleanup = NULL,
+       .readlock = sched_torture_read_lock,
+       .readdelay = rcu_read_delay,  /* just reuse rcu's version. */
+       .readunlock = sched_torture_read_unlock,
+       .completed = sched_torture_completed,
+       .deferredfree = rcu_sync_torture_deferred_free,
+       .sync = sched_torture_synchronize,
+       .stats = NULL,
+       .name = "sched"
+};
+
 static struct rcu_torture_ops *torture_ops[] =
-       { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &srcu_ops, NULL };
+       { &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