OSDN Git Service

torture: Intensify locking test
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 26 Feb 2014 20:14:51 +0000 (12:14 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 14 May 2014 00:03:01 +0000 (17:03 -0700)
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.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/locking/locktorture.c

index f26b1a1..b0d3e3c 100644 (file)
@@ -219,7 +219,8 @@ static int lock_torture_writer(void *arg)
        set_user_nice(current, 19);
 
        do {
-               schedule_timeout_uninterruptible(1);
+               if ((torture_random(&rand) & 0xfffff) == 0)
+                       schedule_timeout_uninterruptible(1);
                cur_ops->writelock();
                if (WARN_ON_ONCE(lock_is_write_held))
                        lwsp->n_write_lock_fail++;