From: Davidlohr Bueso Date: Mon, 15 May 2017 09:07:22 +0000 (-0700) Subject: locking/locktorture: Fix rwsem reader_delay X-Git-Tag: v4.16-rc1~169^2^2^5~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f2f762608f45353b0b8c37507824f95bb716c3d5;p=linux.git locking/locktorture: Fix rwsem reader_delay We should account for nreader threads, not writers in this callback. Could even trigger a div by 0 if the user explicitly disables writers. Signed-off-by: Davidlohr Bueso Signed-off-by: Paul E. McKenney --- diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 617cea2520b3..a307a79e6b0b 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -560,7 +560,7 @@ static void torture_rwsem_read_delay(struct torture_random_state *trsp) /* We want a long delay occasionally to force massive contention. */ if (!(torture_random(trsp) % - (cxt.nrealwriters_stress * 2000 * longdelay_ms))) + (cxt.nrealreaders_stress * 2000 * longdelay_ms))) mdelay(longdelay_ms * 2); else mdelay(longdelay_ms / 2);