diff options
| author | Jia He <justin.he@arm.com> | 2026-05-29 08:58:55 +0000 |
|---|---|---|
| committer | Petr Mladek <pmladek@suse.com> | 2026-06-25 13:28:37 +0200 |
| commit | d6430968d8f323f4f97b6b7d07cca6454db793bd (patch) | |
| tree | b8ccf1d608c50d1602549c61f505344608a7ac53 /scripts/stackusage | |
| parent | 0db1496dcb6621648b007ad0e7d55b876ae0f0bb (diff) | |
| download | linux-d6430968d8f323f4f97b6b7d07cca6454db793bd.tar.gz linux-d6430968d8f323f4f97b6b7d07cca6454db793bd.zip | |
lib/tests: test_ratelimit: fix stress test thread lifecycle and leak
The stress test's WARN_ON_ONCE(!sktp->tp) check in the child thread is
racy and unnecessary: since kthread_run() wakes the thread before
returning, the child can run before sktp[i].tp has been assigned.
Moreover, sktp->tp is never actually used in the child function, so the
check serves no purpose. Remove it and keep the original kthread_run()
Also add a common cleanup path for thread creation failures. If creating
one of the later threads fails, stop all threads that were already
started and free the allocated array instead of leaving orphan kthreads
and leaked memory behind.
Finally, replace the module-static doneflag with kthread_should_stop().
With the doneflag, child threads may exit before the parent calls
kthread_stop(), so the task lifetime is no longer guaranteed when the
parent later tries to stop them. Using kthread_should_stop() keeps each
child alive until kthread_stop() synchronously terminates it.
Suggested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Jia He <justin.he@arm.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://patch.msgid.link/20260529085855.1810870-1-justin.he@arm.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'scripts/stackusage')
0 files changed, 0 insertions, 0 deletions
