aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2020-09-18 19:44:24 +0800
committerPaul E. McKenney <paulmck@kernel.org>2020-11-06 17:13:52 -0800
commite5ace37d83af459bd491847df570b6763c602344 (patch)
tree66f9c596e79916bffda32bee4e420a72464eda04
parentrcutorture: Adjust scenarios SRCU-t and SRCU-u to make kconfig happy (diff)
downloadlinux-dev-e5ace37d83af459bd491847df570b6763c602344.tar.xz
linux-dev-e5ace37d83af459bd491847df570b6763c602344.zip
locktorture: Ignore nreaders_stress if no readlock support
Exclusive locks do not have readlock support, which means that a locktorture run with the following module parameters will do nothing: torture_type=mutex_lock nwriters_stress=0 nreaders_stress=1 This commit therefore rejects this combination for exclusive locks by returning -EINVAL during module init. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
-rw-r--r--kernel/locking/locktorture.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 316531de2a81..046ea2d2bc8c 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -870,7 +870,8 @@ static int __init lock_torture_init(void)
goto unwind;
}
- if (nwriters_stress == 0 && nreaders_stress == 0) {
+ if (nwriters_stress == 0 &&
+ (!cxt.cur_ops->readlock || nreaders_stress == 0)) {
pr_alert("lock-torture: must run at least one locking thread\n");
firsterr = -EINVAL;
goto unwind;