Skip to content

Commit 95f93e9

Browse files
committed
torture: Seed torture_random_state on CPU
The DEFINE_TORTURE_RANDOM_PERCPU() macro defines per-CPU random-number generators for torture testing, but the seeds for each CPU's instance will be identical if they are first used at the same time. This commit therefore adds the CPU number to the mix when reseeding. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 1b929c0 commit 95f93e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/torture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ unsigned long
450450
torture_random(struct torture_random_state *trsp)
451451
{
452452
if (--trsp->trs_count < 0) {
453-
trsp->trs_state += (unsigned long)local_clock();
453+
trsp->trs_state += (unsigned long)local_clock() + raw_smp_processor_id();
454454
trsp->trs_count = TORTURE_RANDOM_REFRESH;
455455
}
456456
trsp->trs_state = trsp->trs_state * TORTURE_RANDOM_MULT +

0 commit comments

Comments
 (0)