The current lock_torture_writer() spends too much time sleeping and not enough time hammering locks, as in an eight-CPU test will often only be utilizing a CPU or two. This commit therefore makes lock_torture_writer() sleep less and hammer more.
Unified · Split
| @@ -219,7 +219,8 @@ static int lock_torture_writer(void *arg) · 218 unmodified lines | ||
| 219 | 219 | set_user_nice(current, 19); |
| 220 | 220 | |
| 221 | 221 | do { |
| 222 | − schedule_timeout_uninterruptible(1); | |
| 222 | + if ((torture_random(&rand) & 0xfffff) == 0) | |
| 223 | + schedule_timeout_uninterruptible(1); | |
| 223 | 224 | cur_ops->writelock(); |
| 224 | 225 | if (WARN_ON_ONCE(lock_is_write_held)) |
| 225 | 226 | lwsp->n_write_lock_fail++; |