Re: re. Spurious wakeup on a newly created kthread
From: Petr Mladek
Date: Tue Jun 28 2022 - 05:51:57 EST
On Sat 2022-06-25 10:01:35, Linus Torvalds wrote:
> On Fri, Jun 24, 2022 at 10:00 PM Tejun Heo <tj@xxxxxxxxxx> wrote:
> For example, the reason that quoted patch cannot be right is that this
> code pattern:
>
> while (wait_for_completion_interruptible(&worker->ready_to_start))
> ;
>
> is not valid kernel code. EVER. There is absolutely no way that can be correct.
>
> Either that code can take a signal, or it cannot. If it can take a
> signal, it had better react to said signal. If it cannot, it must not
> use an interruptble sleep - since now that loop turned into a
> kernel-side busy-loop.
I agree that the code is ugly and does not make sense.
JFYI, I did it this way because I wanted to calm down the hung task
detector. kthreads ignore signals so that I did not think about
this aspect. I though that I saw this trick somewhere.
Do not ask me why I wanted to calm down the hung task detector.
I quess that I felt overloaded and wished a calm day
or something like this. I agree that it does not make
much sense.
Best Regards,
Petr