From: Petr Mladek <pmladek@suse.com>
To: Jia He <justin.he@arm.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] lib/tests: test_ratelimit: fix stress test thread lifecycle and leak
Date: Thu, 25 Jun 2026 13:40:31 +0200 [thread overview]
Message-ID: <aj0Tr2wrMkk9FIJu@pathway.suse.cz> (raw)
In-Reply-To: <20260529085855.1810870-1-justin.he@arm.com>
On Fri 2026-05-29 08:58:55, Jia He wrote:
> 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>
JFYI, the patch has been committed into printk/linux.git,
branch for-7.3.
Best Regards,
Petr
PS: I have already sent pull request for 7.2. And this is
not serious enough to trigger another one.
prev parent reply other threads:[~2026-06-25 11:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 8:58 Jia He
2026-06-24 15:12 ` Petr Mladek
2026-06-24 16:14 ` Paul E. McKenney
2026-06-25 11:40 ` Petr Mladek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aj0Tr2wrMkk9FIJu@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=justin.he@arm.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®