aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcutorture.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2011-08-17 15:39:34 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2011-09-29 00:38:44 -0400
commit93898fb1a395d2a5a53db238c68036da2f8c64d1 (patch)
treebe5b53612cce334959a73617986ab9f3dc859c31 /kernel/rcutorture.c
parent5342e269b2b58ee0b0b4168a94087faaa60d0567 (diff)
rcu: Make rcu_torture_fqs() exit loops at end of test
The rcu_torture_fqs() function can prevent the rcutorture tests from completing, resulting in a hang. This commit therefore ensures that rcu_torture_fqs() will exit its inner loops at the end of the test, and also applies the newish ULONG_CMP_LT() macro to time comparisons. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r--kernel/rcutorture.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index ade7771b208a..2431d576e9ca 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -741,7 +741,7 @@ static int rcu_torture_boost(void *arg)
741 do { 741 do {
742 /* Wait for the next test interval. */ 742 /* Wait for the next test interval. */
743 oldstarttime = boost_starttime; 743 oldstarttime = boost_starttime;
744 while (jiffies - oldstarttime > ULONG_MAX / 2) { 744 while (ULONG_CMP_LT(jiffies, oldstarttime)) {
745 schedule_timeout_uninterruptible(1); 745 schedule_timeout_uninterruptible(1);
746 rcu_stutter_wait("rcu_torture_boost"); 746 rcu_stutter_wait("rcu_torture_boost");
747 if (kthread_should_stop() || 747 if (kthread_should_stop() ||
@@ -752,7 +752,7 @@ static int rcu_torture_boost(void *arg)
752 /* Do one boost-test interval. */ 752 /* Do one boost-test interval. */
753 endtime = oldstarttime + test_boost_duration * HZ; 753 endtime = oldstarttime + test_boost_duration * HZ;
754 call_rcu_time = jiffies; 754 call_rcu_time = jiffies;
755 while (jiffies - endtime > ULONG_MAX / 2) { 755 while (ULONG_CMP_LT(jiffies, endtime)) {
756 /* If we don't have a callback in flight, post one. */ 756 /* If we don't have a callback in flight, post one. */
757 if (!rbi.inflight) { 757 if (!rbi.inflight) {
758 smp_mb(); /* RCU core before ->inflight = 1. */ 758 smp_mb(); /* RCU core before ->inflight = 1. */
@@ -818,11 +818,13 @@ rcu_torture_fqs(void *arg)
818 VERBOSE_PRINTK_STRING("rcu_torture_fqs task started"); 818 VERBOSE_PRINTK_STRING("rcu_torture_fqs task started");
819 do { 819 do {
820 fqs_resume_time = jiffies + fqs_stutter * HZ; 820 fqs_resume_time = jiffies + fqs_stutter * HZ;
821 while (jiffies - fqs_resume_time > LONG_MAX) { 821 while (ULONG_CMP_LT(jiffies, fqs_resume_time) &&
822 !kthread_should_stop()) {
822 schedule_timeout_interruptible(1); 823 schedule_timeout_interruptible(1);
823 } 824 }
824 fqs_burst_remaining = fqs_duration; 825 fqs_burst_remaining = fqs_duration;
825 while (fqs_burst_remaining > 0) { 826 while (fqs_burst_remaining > 0 &&
827 !kthread_should_stop()) {
826 cur_ops->fqs(); 828 cur_ops->fqs();
827 udelay(fqs_holdoff); 829 udelay(fqs_holdoff);
828 fqs_burst_remaining -= fqs_holdoff; 830 fqs_burst_remaining -= fqs_holdoff;