]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
torture: Allow inter-stutter interval to be specified
authorPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 9 Apr 2019 21:44:49 +0000 (14:44 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 28 May 2019 16:06:09 +0000 (09:06 -0700)
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>
include/linux/torture.h
kernel/locking/locktorture.c
kernel/rcu/rcutorture.c
kernel/torture.c

index 23d80db426d7433c1df0f11de33a4beab2c9f145..a620118385bb1a95a137618fb3cd5345979879fe 100644 (file)
@@ -66,7 +66,7 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void));
 
 /* Task stuttering, which forces load/no-load transitions. */
 bool stutter_wait(const char *title);
-int torture_stutter_init(int s);
+int torture_stutter_init(int s, int sgap);
 
 /* Initialization and cleanup. */
 bool torture_init_begin(char *ttype, int v);
index 80a463d31a8d95a89ab2fb5cdc2b99686cb872d0..c513031cd7e3300fcc89a4340f673dd80cb59443 100644 (file)
@@ -975,7 +975,7 @@ static int __init lock_torture_init(void)
                        goto unwind;
        }
        if (stutter > 0) {
-               firsterr = torture_stutter_init(stutter);
+               firsterr = torture_stutter_init(stutter, stutter);
                if (firsterr)
                        goto unwind;
        }
index 954ac2b986193d7fb9291b3f3f5df7cf67c6da8d..a16d6abe1715665eb38acf2bf820340f21685dc8 100644 (file)
@@ -2373,7 +2373,10 @@ rcu_torture_init(void)
        if (stutter < 0)
                stutter = 0;
        if (stutter) {
-               firsterr = torture_stutter_init(stutter * HZ);
+               int t;
+
+               t = cur_ops->stall_dur ? cur_ops->stall_dur() : stutter * HZ;
+               firsterr = torture_stutter_init(stutter * HZ, t);
                if (firsterr)
                        goto unwind;
        }
index de0e0ecf88e1693bbc5a16acf676d187a0c47f5b..a8d9bdfba7c37280cb335bf6c4aeca615d05dcbb 100644 (file)
@@ -570,6 +570,7 @@ static void torture_shutdown_cleanup(void)
 static struct task_struct *stutter_task;
 static int stutter_pause_test;
 static int stutter;
+static int stutter_gap;
 
 /*
  * Block until the stutter interval ends.  This must be called periodically
@@ -621,7 +622,7 @@ static int torture_stutter(void *arg)
                }
                WRITE_ONCE(stutter_pause_test, 0);
                if (!torture_must_stop())
-                       schedule_timeout_interruptible(stutter);
+                       schedule_timeout_interruptible(stutter_gap);
                torture_shutdown_absorb("torture_stutter");
        } while (!torture_must_stop());
        torture_kthread_stopping("torture_stutter");
@@ -631,9 +632,10 @@ static int torture_stutter(void *arg)
 /*
  * Initialize and kick off the torture_stutter kthread.
  */
-int torture_stutter_init(const int s)
+int torture_stutter_init(const int s, const int sgap)
 {
        stutter = s;
+       stutter_gap = sgap;
        return torture_create_kthread(torture_stutter, NULL, stutter_task);
 }
 EXPORT_SYMBOL_GPL(torture_stutter_init);