Skip to content

Commit c0e1472

Browse files
committed
locktorture: Use private random-number generators
Both lock_torture_writer() and lock_torture_reader() use the "static" keyword on their DEFINE_TORTURE_RANDOM(rand) declarations, which means that a single instance of a random-number generator are shared among all the writers and another is shared among all the readers. Unfortunately, this random-number generator was not designed for concurrent access. This commit therefore removes both "static" keywords so that each reader and each writer gets its own random-number generator. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 7aabb6f commit c0e1472

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/locking/locktorture.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static struct lock_torture_ops percpu_rwsem_lock_ops = {
618618
static int lock_torture_writer(void *arg)
619619
{
620620
struct lock_stress_stats *lwsp = arg;
621-
static DEFINE_TORTURE_RANDOM(rand);
621+
DEFINE_TORTURE_RANDOM(rand);
622622

623623
VERBOSE_TOROUT_STRING("lock_torture_writer task started");
624624
set_user_nice(current, MAX_NICE);
@@ -655,7 +655,7 @@ static int lock_torture_writer(void *arg)
655655
static int lock_torture_reader(void *arg)
656656
{
657657
struct lock_stress_stats *lrsp = arg;
658-
static DEFINE_TORTURE_RANDOM(rand);
658+
DEFINE_TORTURE_RANDOM(rand);
659659

660660
VERBOSE_TOROUT_STRING("lock_torture_reader task started");
661661
set_user_nice(current, MAX_NICE);

0 commit comments

Comments
 (0)