]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
torture: Stop right-shifting torture_random() return values
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 12 Jul 2023 21:56:51 +0000 (14:56 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 14 Aug 2023 22:01:08 +0000 (15:01 -0700)
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 <paulmck@kernel.org>
kernel/torture.c

index 984651de4b5532bc5d56f10d906837637edf6e86..b28b05bbef02702c52ec88e13e627fedbb3c215d 100644 (file)
@@ -92,7 +92,7 @@ int torture_hrtimeout_ns(ktime_t baset_ns, u32 fuzzt_ns, struct torture_random_s
        ktime_t hto = baset_ns;
 
        if (trsp)
-               hto += (torture_random(trsp) >> 3) % fuzzt_ns;
+               hto += torture_random(trsp) % fuzzt_ns;
        set_current_state(TASK_IDLE);
        return schedule_hrtimeout(&hto, HRTIMER_MODE_REL);
 }
@@ -362,7 +362,7 @@ torture_onoff(void *arg)
                        torture_hrtimeout_jiffies(HZ / 10, &rand);
                        continue;
                }
-               cpu = (torture_random(&rand) >> 4) % (maxcpu + 1);
+               cpu = torture_random(&rand) % (maxcpu + 1);
                if (!torture_offline(cpu,
                                     &n_offline_attempts, &n_offline_successes,
                                     &sum_offline, &min_offline, &max_offline))