summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.ibm.com>2019-04-09 17:44:49 -0400
committerPaul E. McKenney <paulmck@linux.ibm.com>2019-05-28 12:06:09 -0400
commitff3bf92d90d396e51eb78c5ecde11a994ab7a179 (patch)
tree6ba832a9d6128bf12478f8df3b5710431d2c9668
parente8516c64fe97e27a28fd5bc65b616508ae0020cf (diff)
torture: Allow inter-stutter interval to be specified
Currently, the inter-stutter interval is the same as the stutter duration, that is, whatever number of jiffies is passed into torture_stutter_init(). This has worked well for quite some time, but the addition of forward-progress testing to rcutorture can delay processes for several seconds, which can triple the time that they are stuttered. This commit therefore adds a second argument to torture_stutter_init() that specifies the inter-stutter interval. While locktorture preserves the current behavior, rcutorture uses the RCU CPU stall warning interval to provide a wider inter-stutter interval. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
-rw-r--r--include/linux/torture.h2
-rw-r--r--kernel/locking/locktorture.c2
-rw-r--r--kernel/rcu/rcutorture.c5
-rw-r--r--kernel/torture.c6
4 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 23d80db426d7..a620118385bb 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -66,7 +66,7 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void));
66 66
67/* Task stuttering, which forces load/no-load transitions. */ 67/* Task stuttering, which forces load/no-load transitions. */
68bool stutter_wait(const char *title); 68bool stutter_wait(const char *title);
69int torture_stutter_init(int s); 69int torture_stutter_init(int s, int sgap);
70 70
71/* Initialization and cleanup. */ 71/* Initialization and cleanup. */
72bool torture_init_begin(char *ttype, int v); 72bool torture_init_begin(char *ttype, int v);
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 80a463d31a8d..c513031cd7e3 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -975,7 +975,7 @@ static int __init lock_torture_init(void)
975 goto unwind; 975 goto unwind;
976 } 976 }
977 if (stutter > 0) { 977 if (stutter > 0) {
978 firsterr = torture_stutter_init(stutter); 978 firsterr = torture_stutter_init(stutter, stutter);
979 if (firsterr) 979 if (firsterr)
980 goto unwind; 980 goto unwind;
981 } 981 }
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 954ac2b98619..a16d6abe1715 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -2373,7 +2373,10 @@ rcu_torture_init(void)
2373 if (stutter < 0) 2373 if (stutter < 0)
2374 stutter = 0; 2374 stutter = 0;
2375 if (stutter) { 2375 if (stutter) {
2376 firsterr = torture_stutter_init(stutter * HZ); 2376 int t;
2377
2378 t = cur_ops->stall_dur ? cur_ops->stall_dur() : stutter * HZ;
2379 firsterr = torture_stutter_init(stutter * HZ, t);
2377 if (firsterr) 2380 if (firsterr)
2378 goto unwind; 2381 goto unwind;
2379 } 2382 }
diff --git a/kernel/torture.c b/kernel/torture.c
index de0e0ecf88e1..a8d9bdfba7c3 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -570,6 +570,7 @@ static void torture_shutdown_cleanup(void)
570static struct task_struct *stutter_task; 570static struct task_struct *stutter_task;
571static int stutter_pause_test; 571static int stutter_pause_test;
572static int stutter; 572static int stutter;
573static int stutter_gap;
573 574
574/* 575/*
575 * Block until the stutter interval ends. This must be called periodically 576 * Block until the stutter interval ends. This must be called periodically
@@ -621,7 +622,7 @@ static int torture_stutter(void *arg)
621 } 622 }
622 WRITE_ONCE(stutter_pause_test, 0); 623 WRITE_ONCE(stutter_pause_test, 0);
623 if (!torture_must_stop()) 624 if (!torture_must_stop())
624 schedule_timeout_interruptible(stutter); 625 schedule_timeout_interruptible(stutter_gap);
625 torture_shutdown_absorb("torture_stutter"); 626 torture_shutdown_absorb("torture_stutter");
626 } while (!torture_must_stop()); 627 } while (!torture_must_stop());
627 torture_kthread_stopping("torture_stutter"); 628 torture_kthread_stopping("torture_stutter");
@@ -631,9 +632,10 @@ static int torture_stutter(void *arg)
631/* 632/*
632 * Initialize and kick off the torture_stutter kthread. 633 * Initialize and kick off the torture_stutter kthread.
633 */ 634 */
634int torture_stutter_init(const int s) 635int torture_stutter_init(const int s, const int sgap)
635{ 636{
636 stutter = s; 637 stutter = s;
638 stutter_gap = sgap;
637 return torture_create_kthread(torture_stutter, NULL, stutter_task); 639 return torture_create_kthread(torture_stutter, NULL, stutter_task);
638} 640}
639EXPORT_SYMBOL_GPL(torture_stutter_init); 641EXPORT_SYMBOL_GPL(torture_stutter_init);