History

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.

Paul E. McKenney committed 6 years ago

Commit c0e14721 parent 7aabb6f1 file · +2 −2Browse files

Unified · Split

kernel/locking/locktorture.c+2−2
@@ -618,7 +618,7 @@ static struct lock_torture_ops percpu_rwsem_lock_ops = { · 617 unmodified lines
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) · 30 unmodified lines
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);