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.
Showing the changes to kernel/locking (1 of 1 file). Show all
Unified · Split
| @@ -618,7 +618,7 @@ static struct lock_torture_ops percpu_rwsem_lock_ops = { · 617 unmodified lines | |||
| 618 | static int lock_torture_writer(void *arg) | 618 | static int lock_torture_writer(void *arg) |
| 619 | { | 619 | { |
| 620 | struct lock_stress_stats *lwsp = arg; | 620 | struct lock_stress_stats *lwsp = arg; |
| 621 | static DEFINE_TORTURE_RANDOM(rand); | 621 | DEFINE_TORTURE_RANDOM(rand); |
| 622 | 622 | ||
| 623 | VERBOSE_TOROUT_STRING("lock_torture_writer task started"); | 623 | VERBOSE_TOROUT_STRING("lock_torture_writer task started"); |
| 624 | set_user_nice(current, MAX_NICE); | 624 | set_user_nice(current, MAX_NICE); |
| @@ -655,7 +655,7 @@ static int lock_torture_writer(void *arg) · 30 unmodified lines | |||
| 655 | static int lock_torture_reader(void *arg) | 655 | static int lock_torture_reader(void *arg) |
| 656 | { | 656 | { |
| 657 | struct lock_stress_stats *lrsp = arg; | 657 | struct lock_stress_stats *lrsp = arg; |
| 658 | static DEFINE_TORTURE_RANDOM(rand); | 658 | DEFINE_TORTURE_RANDOM(rand); |
| 659 | 659 | ||
| 660 | VERBOSE_TOROUT_STRING("lock_torture_reader task started"); | 660 | VERBOSE_TOROUT_STRING("lock_torture_reader task started"); |
| 661 | set_user_nice(current, MAX_NICE); | 661 | set_user_nice(current, MAX_NICE); |