aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcutorture.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2012-03-19 04:12:14 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2012-04-30 13:48:26 -0400
commit9059c94017f748d9e20c3b089188a7abb27f6233 (patch)
treef4f4397f732ce690602519da8594fc5ac306b252 /kernel/rcutorture.c
parent931ea9d1a6e06a5e3af03aa4aaaa7c7fd90e163f (diff)
rcu: Add rcutorture test for call_srcu()
Add srcu_torture_deferred_free() for srcu_ops so as to test the new call_srcu(). Rename the original srcu_ops to srcu_sync_ops. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r--kernel/rcutorture.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index d10b179dea83..e66b34ab7555 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -625,6 +625,11 @@ static int srcu_torture_completed(void)
625 return srcu_batches_completed(&srcu_ctl); 625 return srcu_batches_completed(&srcu_ctl);
626} 626}
627 627
628static void srcu_torture_deferred_free(struct rcu_torture *rp)
629{
630 call_srcu(&srcu_ctl, &rp->rtort_rcu, rcu_torture_cb);
631}
632
628static void srcu_torture_synchronize(void) 633static void srcu_torture_synchronize(void)
629{ 634{
630 synchronize_srcu(&srcu_ctl); 635 synchronize_srcu(&srcu_ctl);
@@ -654,7 +659,7 @@ static struct rcu_torture_ops srcu_ops = {
654 .read_delay = srcu_read_delay, 659 .read_delay = srcu_read_delay,
655 .readunlock = srcu_torture_read_unlock, 660 .readunlock = srcu_torture_read_unlock,
656 .completed = srcu_torture_completed, 661 .completed = srcu_torture_completed,
657 .deferred_free = rcu_sync_torture_deferred_free, 662 .deferred_free = srcu_torture_deferred_free,
658 .sync = srcu_torture_synchronize, 663 .sync = srcu_torture_synchronize,
659 .call = NULL, 664 .call = NULL,
660 .cb_barrier = NULL, 665 .cb_barrier = NULL,
@@ -662,6 +667,21 @@ static struct rcu_torture_ops srcu_ops = {
662 .name = "srcu" 667 .name = "srcu"
663}; 668};
664 669
670static struct rcu_torture_ops srcu_sync_ops = {
671 .init = srcu_torture_init,
672 .cleanup = srcu_torture_cleanup,
673 .readlock = srcu_torture_read_lock,
674 .read_delay = srcu_read_delay,
675 .readunlock = srcu_torture_read_unlock,
676 .completed = srcu_torture_completed,
677 .deferred_free = rcu_sync_torture_deferred_free,
678 .sync = srcu_torture_synchronize,
679 .call = NULL,
680 .cb_barrier = NULL,
681 .stats = srcu_torture_stats,
682 .name = "srcu_sync"
683};
684
665static int srcu_torture_read_lock_raw(void) __acquires(&srcu_ctl) 685static int srcu_torture_read_lock_raw(void) __acquires(&srcu_ctl)
666{ 686{
667 return srcu_read_lock_raw(&srcu_ctl); 687 return srcu_read_lock_raw(&srcu_ctl);
@@ -679,7 +699,7 @@ static struct rcu_torture_ops srcu_raw_ops = {
679 .read_delay = srcu_read_delay, 699 .read_delay = srcu_read_delay,
680 .readunlock = srcu_torture_read_unlock_raw, 700 .readunlock = srcu_torture_read_unlock_raw,
681 .completed = srcu_torture_completed, 701 .completed = srcu_torture_completed,
682 .deferred_free = rcu_sync_torture_deferred_free, 702 .deferred_free = srcu_torture_deferred_free,
683 .sync = srcu_torture_synchronize, 703 .sync = srcu_torture_synchronize,
684 .call = NULL, 704 .call = NULL,
685 .cb_barrier = NULL, 705 .cb_barrier = NULL,
@@ -687,6 +707,21 @@ static struct rcu_torture_ops srcu_raw_ops = {
687 .name = "srcu_raw" 707 .name = "srcu_raw"
688}; 708};
689 709
710static struct rcu_torture_ops srcu_raw_sync_ops = {
711 .init = srcu_torture_init,
712 .cleanup = srcu_torture_cleanup,
713 .readlock = srcu_torture_read_lock_raw,
714 .read_delay = srcu_read_delay,
715 .readunlock = srcu_torture_read_unlock_raw,
716 .completed = srcu_torture_completed,
717 .deferred_free = rcu_sync_torture_deferred_free,
718 .sync = srcu_torture_synchronize,
719 .call = NULL,
720 .cb_barrier = NULL,
721 .stats = srcu_torture_stats,
722 .name = "srcu_raw_sync"
723};
724
690static void srcu_torture_synchronize_expedited(void) 725static void srcu_torture_synchronize_expedited(void)
691{ 726{
692 synchronize_srcu_expedited(&srcu_ctl); 727 synchronize_srcu_expedited(&srcu_ctl);
@@ -1685,7 +1720,7 @@ static int rcu_torture_barrier_init(void)
1685 for (i = 0; i < n_barrier_cbs; i++) { 1720 for (i = 0; i < n_barrier_cbs; i++) {
1686 init_waitqueue_head(&barrier_cbs_wq[i]); 1721 init_waitqueue_head(&barrier_cbs_wq[i]);
1687 barrier_cbs_tasks[i] = kthread_run(rcu_torture_barrier_cbs, 1722 barrier_cbs_tasks[i] = kthread_run(rcu_torture_barrier_cbs,
1688 (void *)i, 1723 (void *)(long)i,
1689 "rcu_torture_barrier_cbs"); 1724 "rcu_torture_barrier_cbs");
1690 if (IS_ERR(barrier_cbs_tasks[i])) { 1725 if (IS_ERR(barrier_cbs_tasks[i])) {
1691 ret = PTR_ERR(barrier_cbs_tasks[i]); 1726 ret = PTR_ERR(barrier_cbs_tasks[i]);
@@ -1873,7 +1908,8 @@ rcu_torture_init(void)
1873 static struct rcu_torture_ops *torture_ops[] = 1908 static struct rcu_torture_ops *torture_ops[] =
1874 { &rcu_ops, &rcu_sync_ops, &rcu_expedited_ops, 1909 { &rcu_ops, &rcu_sync_ops, &rcu_expedited_ops,
1875 &rcu_bh_ops, &rcu_bh_sync_ops, &rcu_bh_expedited_ops, 1910 &rcu_bh_ops, &rcu_bh_sync_ops, &rcu_bh_expedited_ops,
1876 &srcu_ops, &srcu_raw_ops, &srcu_expedited_ops, 1911 &srcu_ops, &srcu_sync_ops, &srcu_raw_ops,
1912 &srcu_raw_sync_ops, &srcu_expedited_ops,
1877 &sched_ops, &sched_sync_ops, &sched_expedited_ops, }; 1913 &sched_ops, &sched_sync_ops, &sched_expedited_ops, };
1878 1914
1879 mutex_lock(&fullstop_mutex); 1915 mutex_lock(&fullstop_mutex);