Linux RCU subsystem development
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
	"Paul E. McKenney" <paulmck@linux.ibm.com>
Subject: [PATCH tip/core/rcu 05/21] torture: Allow inter-stutter interval to be specified
Date: Thu, 30 May 2019 08:16:56 -0700	[thread overview]
Message-ID: <20190530151712.1612-5-paulmck@linux.ibm.com> (raw)
In-Reply-To: <20190530151650.GA422@linux.ibm.com>

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      | 2 +-
 kernel/locking/locktorture.c | 2 +-
 kernel/rcu/rcutorture.c      | 5 ++++-
 kernel/torture.c             | 6 ++++--
 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));
 
 /* 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);
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)
 			goto unwind;
 	}
 	if (stutter > 0) {
-		firsterr = torture_stutter_init(stutter);
+		firsterr = torture_stutter_init(stutter, stutter);
 		if (firsterr)
 			goto unwind;
 	}
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)
 	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;
 	}
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)
 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);
-- 
2.17.1


  parent reply	other threads:[~2019-05-30 15:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 15:16 [PATCH tip/core/rcu 0/21] Torture-test updates for v5.3 Paul E. McKenney
2019-05-30 15:16 ` [PATCH tip/core/rcu 01/21] rcutorture: Select from only online CPUs Paul E. McKenney
2019-05-30 15:16 ` [PATCH tip/core/rcu 02/21] rcutorture: Add cpu0 to the set of CPUs to add jitter Paul E. McKenney
2019-05-30 15:16 ` [PATCH tip/core/rcu 03/21] rcutorture: Add cond_resched() to forward-progress free-up loop Paul E. McKenney
2019-05-30 15:16 ` [PATCH tip/core/rcu 04/21] rcutorture: Fix stutter_wait() return value and freelist checks Paul E. McKenney
2019-05-30 15:16 ` Paul E. McKenney [this message]
2019-05-30 15:16 ` [PATCH tip/core/rcu 06/21] torture: Make kvm-find-errors.sh and kvm-recheck.sh provide exit status Paul E. McKenney
2019-05-30 15:16 ` [PATCH tip/core/rcu 07/21] rcutorture: Provide rudimentary Makefile Paul E. McKenney
2019-05-30 15:16 ` [PATCH tip/core/rcu 08/21] rcutorture: Exempt tasks RCU from timely draining of grace periods Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 09/21] rcutorture: Exempt TREE01 from forward-progress testing Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 10/21] rcutorture: Give the scheduler a chance on PREEMPT && NO_HZ_FULL kernels Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 11/21] rcutorture: Halt forward-progress checks at end of run Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 12/21] rcutorture: Add trivial RCU implementation Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 13/21] rcutorture: Tweak kvm options Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 14/21] torture: Capture qemu output Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 15/21] torture: Add function graph-tracing cheat sheet Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 16/21] torture: Run kernel build in source directory Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 17/21] torture: Make --cpus override idleness calculations Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 18/21] torture: Add --trust-make to suppress "make clean" Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 19/21] rcutorture: Dump trace buffer for callback pipe drain failures Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 20/21] torture: Suppress propagating trace_printk() warning Paul E. McKenney
2019-05-30 15:17 ` [PATCH tip/core/rcu 21/21] rcutorture: Upper case solves the case of the vanishing NULL pointer Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190530151712.1612-5-paulmck@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox