mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
scftorture: Make invoker threads actually wait for all threads to start
Each scftorture_invoker() thread decrements n_started, which is initialized to the number of threads, and is then supposed to wait until all of its siblings have also checked in before starting the test proper. However, the wait loop is guarded by !atomic_dec_return(&n_started), which is true only for the final thread to arrive, and by then n_started is already zero, so the final thread does not wait either. The side-effect (possibly positive) is that no thread ever waits and the start-synchronization barrier is dead code, with early threads beginning to hammer smp_call_function*() while later threads are still being spawned. Invert the test so that every thread other than the last spins until n_started reaches zero, making the threads start testing together as intended. The existing torture_must_stop() check in the wait loop continues to bound the wait during shutdown. We can also drop the spinning entirely if the intent is to leave it as dead code, however for the current intent, this patches fixes the code. Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
34ff636f32
commit
8b5b048277
|
|
@ -497,7 +497,7 @@ static int scftorture_invoker(void *arg)
|
|||
"%s: Wanted CPU %d, running on %d, nr_cpu_ids = %d\n",
|
||||
__func__, scfp->cpu, curcpu, nr_cpu_ids);
|
||||
|
||||
if (!atomic_dec_return(&n_started))
|
||||
if (atomic_dec_return(&n_started))
|
||||
while (atomic_read_acquire(&n_started)) {
|
||||
if (torture_must_stop()) {
|
||||
VERBOSE_SCFTORTOUT("scftorture_invoker %d ended before starting", scfp->cpu);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user