Commit 95f93e97 authored by Paul E. McKenney's avatar Paul E. McKenney

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: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 1b929c02
...@@ -450,7 +450,7 @@ unsigned long ...@@ -450,7 +450,7 @@ unsigned long
torture_random(struct torture_random_state *trsp) torture_random(struct torture_random_state *trsp)
{ {
if (--trsp->trs_count < 0) { if (--trsp->trs_count < 0) {
trsp->trs_state += (unsigned long)local_clock(); trsp->trs_state += (unsigned long)local_clock() + raw_smp_processor_id();
trsp->trs_count = TORTURE_RANDOM_REFRESH; trsp->trs_count = TORTURE_RANDOM_REFRESH;
} }
trsp->trs_state = trsp->trs_state * TORTURE_RANDOM_MULT + trsp->trs_state = trsp->trs_state * TORTURE_RANDOM_MULT +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment