Skip to content

Commit bc19e86

Browse files
committed
rcutorture: Stop right-shifting torture_random() return values
Now that torture_random() uses swahw32(), its callers no longer see not-so-random low-order bits, as these are now swapped up into the upper 16 bits of the torture_random() function's return value. This commit therefore removes the right-shifting of torture_random() return values. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 6cab60c commit bc19e86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/rcu/rcutorture.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ static int
18771877
rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp)
18781878
{
18791879
int mask = rcutorture_extend_mask_max();
1880-
unsigned long randmask1 = torture_random(trsp) >> 8;
1880+
unsigned long randmask1 = torture_random(trsp);
18811881
unsigned long randmask2 = randmask1 >> 3;
18821882
unsigned long preempts = RCUTORTURE_RDR_PREEMPT | RCUTORTURE_RDR_SCHED;
18831883
unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ;
@@ -1936,7 +1936,7 @@ rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp,
19361936
if (!((mask - 1) & mask))
19371937
return rtrsp; /* Current RCU reader not extendable. */
19381938
/* Bias towards larger numbers of loops. */
1939-
i = (torture_random(trsp) >> 3);
1939+
i = torture_random(trsp);
19401940
i = ((i | (i >> 3)) & RCUTORTURE_RDR_MAX_LOOPS) + 1;
19411941
for (j = 0; j < i; j++) {
19421942
mask = rcutorture_extend_mask(*readstate, trsp);
@@ -2137,7 +2137,7 @@ static int rcu_nocb_toggle(void *arg)
21372137
toggle_fuzz = NSEC_PER_USEC;
21382138
do {
21392139
r = torture_random(&rand);
2140-
cpu = (r >> 4) % (maxcpu + 1);
2140+
cpu = (r >> 1) % (maxcpu + 1);
21412141
if (r & 0x1) {
21422142
rcu_nocb_cpu_offload(cpu);
21432143
atomic_long_inc(&n_nocb_offload);

0 commit comments

Comments
 (0)