summaryrefslogtreecommitdiffstats
path: root/kernel/torture.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2022-11-06 18:16:14 -0800
committerPaul E. McKenney <paulmck@kernel.org>2023-01-03 17:52:54 -0800
commit95f93e97ed0f56f54f74293a0a82e05599d5078d (patch)
tree7219e80f6e48e23014daeb1175a4048b84f17530 /kernel/torture.c
parent1b929c02afd37871d5afb9d498426f83432e71c2 (diff)
downloadlinux-95f93e97ed0f56f54f74293a0a82e05599d5078d.tar.gz
linux-95f93e97ed0f56f54f74293a0a82e05599d5078d.tar.bz2
linux-95f93e97ed0f56f54f74293a0a82e05599d5078d.zip
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 <paulmck@kernel.org>
Diffstat (limited to 'kernel/torture.c')
-rw-r--r--kernel/torture.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/torture.c b/kernel/torture.c
index 789aeb0e1159..29afc62f2bfe 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -450,7 +450,7 @@ unsigned long
torture_random(struct torture_random_state *trsp)
{
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_state = trsp->trs_state * TORTURE_RANDOM_MULT +