diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-12-02 15:10:15 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-03 05:35:25 -0500 |
commit | d9a3da0699b24a589b27a61e1a5b5bd30d9db669 (patch) | |
tree | f7440e396a6c818f3cef514ccc31ab55d88025ef /kernel/rcutorture.c | |
parent | cf244dc01bf68e1ad338b82447f8686d24ea4435 (diff) |
rcu: Add expedited grace-period support for preemptible RCU
Implement an synchronize_rcu_expedited() for preemptible RCU
that actually is expedited. This uses
synchronize_sched_expedited() to force all threads currently
running in a preemptible-RCU read-side critical section onto the
appropriate ->blocked_tasks[] list, then takes a snapshot of all
of these lists and waits for them to drain.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <1259784616158-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r-- | kernel/rcutorture.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 3dd0ca23e191..a621a67ef4e3 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -327,6 +327,11 @@ rcu_torture_cb(struct rcu_head *p) | |||
327 | cur_ops->deferred_free(rp); | 327 | cur_ops->deferred_free(rp); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int rcu_no_completed(void) | ||
331 | { | ||
332 | return 0; | ||
333 | } | ||
334 | |||
330 | static void rcu_torture_deferred_free(struct rcu_torture *p) | 335 | static void rcu_torture_deferred_free(struct rcu_torture *p) |
331 | { | 336 | { |
332 | call_rcu(&p->rtort_rcu, rcu_torture_cb); | 337 | call_rcu(&p->rtort_rcu, rcu_torture_cb); |
@@ -388,6 +393,21 @@ static struct rcu_torture_ops rcu_sync_ops = { | |||
388 | .name = "rcu_sync" | 393 | .name = "rcu_sync" |
389 | }; | 394 | }; |
390 | 395 | ||
396 | static struct rcu_torture_ops rcu_expedited_ops = { | ||
397 | .init = rcu_sync_torture_init, | ||
398 | .cleanup = NULL, | ||
399 | .readlock = rcu_torture_read_lock, | ||
400 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ | ||
401 | .readunlock = rcu_torture_read_unlock, | ||
402 | .completed = rcu_no_completed, | ||
403 | .deferred_free = rcu_sync_torture_deferred_free, | ||
404 | .sync = synchronize_rcu_expedited, | ||
405 | .cb_barrier = NULL, | ||
406 | .stats = NULL, | ||
407 | .irq_capable = 1, | ||
408 | .name = "rcu_expedited" | ||
409 | }; | ||
410 | |||
391 | /* | 411 | /* |
392 | * Definitions for rcu_bh torture testing. | 412 | * Definitions for rcu_bh torture testing. |
393 | */ | 413 | */ |
@@ -581,11 +601,6 @@ static void sched_torture_read_unlock(int idx) | |||
581 | preempt_enable(); | 601 | preempt_enable(); |
582 | } | 602 | } |
583 | 603 | ||
584 | static int sched_torture_completed(void) | ||
585 | { | ||
586 | return 0; | ||
587 | } | ||
588 | |||
589 | static void rcu_sched_torture_deferred_free(struct rcu_torture *p) | 604 | static void rcu_sched_torture_deferred_free(struct rcu_torture *p) |
590 | { | 605 | { |
591 | call_rcu_sched(&p->rtort_rcu, rcu_torture_cb); | 606 | call_rcu_sched(&p->rtort_rcu, rcu_torture_cb); |
@@ -602,7 +617,7 @@ static struct rcu_torture_ops sched_ops = { | |||
602 | .readlock = sched_torture_read_lock, | 617 | .readlock = sched_torture_read_lock, |
603 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ | 618 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ |
604 | .readunlock = sched_torture_read_unlock, | 619 | .readunlock = sched_torture_read_unlock, |
605 | .completed = sched_torture_completed, | 620 | .completed = rcu_no_completed, |
606 | .deferred_free = rcu_sched_torture_deferred_free, | 621 | .deferred_free = rcu_sched_torture_deferred_free, |
607 | .sync = sched_torture_synchronize, | 622 | .sync = sched_torture_synchronize, |
608 | .cb_barrier = rcu_barrier_sched, | 623 | .cb_barrier = rcu_barrier_sched, |
@@ -617,7 +632,7 @@ static struct rcu_torture_ops sched_sync_ops = { | |||
617 | .readlock = sched_torture_read_lock, | 632 | .readlock = sched_torture_read_lock, |
618 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ | 633 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ |
619 | .readunlock = sched_torture_read_unlock, | 634 | .readunlock = sched_torture_read_unlock, |
620 | .completed = sched_torture_completed, | 635 | .completed = rcu_no_completed, |
621 | .deferred_free = rcu_sync_torture_deferred_free, | 636 | .deferred_free = rcu_sync_torture_deferred_free, |
622 | .sync = sched_torture_synchronize, | 637 | .sync = sched_torture_synchronize, |
623 | .cb_barrier = NULL, | 638 | .cb_barrier = NULL, |
@@ -631,7 +646,7 @@ static struct rcu_torture_ops sched_expedited_ops = { | |||
631 | .readlock = sched_torture_read_lock, | 646 | .readlock = sched_torture_read_lock, |
632 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ | 647 | .read_delay = rcu_read_delay, /* just reuse rcu's version. */ |
633 | .readunlock = sched_torture_read_unlock, | 648 | .readunlock = sched_torture_read_unlock, |
634 | .completed = sched_torture_completed, | 649 | .completed = rcu_no_completed, |
635 | .deferred_free = rcu_sync_torture_deferred_free, | 650 | .deferred_free = rcu_sync_torture_deferred_free, |
636 | .sync = synchronize_sched_expedited, | 651 | .sync = synchronize_sched_expedited, |
637 | .cb_barrier = NULL, | 652 | .cb_barrier = NULL, |
@@ -1116,7 +1131,8 @@ rcu_torture_init(void) | |||
1116 | int cpu; | 1131 | int cpu; |
1117 | int firsterr = 0; | 1132 | int firsterr = 0; |
1118 | static struct rcu_torture_ops *torture_ops[] = | 1133 | static struct rcu_torture_ops *torture_ops[] = |
1119 | { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, | 1134 | { &rcu_ops, &rcu_sync_ops, &rcu_expedited_ops, |
1135 | &rcu_bh_ops, &rcu_bh_sync_ops, | ||
1120 | &srcu_ops, &srcu_expedited_ops, | 1136 | &srcu_ops, &srcu_expedited_ops, |
1121 | &sched_ops, &sched_sync_ops, &sched_expedited_ops, }; | 1137 | &sched_ops, &sched_sync_ops, &sched_expedited_ops, }; |
1122 | 1138 | ||