public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] signal: break out of wait loops on kthread_stop()
Date: Mon, 11 Jul 2022 17:04:22 -0500	[thread overview]
Message-ID: <87pmib9uhl.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <YsyFhfAunVfVQKci@zx2c4.com> (Jason A. Donenfeld's message of "Mon, 11 Jul 2022 22:18:13 +0200")

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> Hi Eric,
>
> Thanks for the review.
>
>> Which I guess my long way of saying I think you can just change
>> kthread_stop to say:
>> 
>> diff --git a/kernel/kthread.c b/kernel/kthread.c
>> index 544fd4097406..52e9b3432496 100644
>> --- a/kernel/kthread.c
>> +++ b/kernel/kthread.c
>> @@ -704,6 +704,7 @@ int kthread_stop(struct task_struct *k)
>>  	kthread = to_kthread(k);
>>  	set_bit(KTHREAD_SHOULD_STOP, &kthread->flags);
>>  	kthread_unpark(k);
>> +	set_tsk_thread_flag(k, TIF_NOTIFY_SIGNAL);
>>  	wake_up_process(k);
>>  	wait_for_completion(&kthread->exited);
>>  	ret = kthread->result;
>> 
>
> Okay. I'll constrain it to just kthread_stop(). But please file away in
> the back of your mind the potential for kthread_park() to be problematic
> down the line, in case we have to fix that later.

Definitely.  Right now I am certain you are motivated to test and make
certain the kthread_stop case will work.  I just have the feeling that
we don't care enough about kthread_park, and so attempting to solve it
now is as likely to cause problems as solve them.

Eric

      parent reply	other threads:[~2022-07-11 22:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 12:00 [PATCH] signal: break out of wait loops on kthread_stop() Jason A. Donenfeld
2022-06-27 13:27 ` Peter Zijlstra
2022-06-27 14:54   ` Jason A. Donenfeld
2022-06-27 14:57     ` [PATCH v2] " Jason A. Donenfeld
2022-06-27 19:16       ` Eric W. Biederman
2022-06-28 15:59         ` Jason A. Donenfeld
2022-06-28 16:14           ` [PATCH v3] " Jason A. Donenfeld
2022-07-04 12:22             ` Jason A. Donenfeld
2022-07-11 17:53               ` Jason A. Donenfeld
2022-07-11 18:57                 ` Eric W. Biederman
2022-07-11 20:18                   ` Jason A. Donenfeld
2022-07-11 20:21                     ` [PATCH v4] " Jason A. Donenfeld
2022-07-11 22:05                       ` Eric W. Biederman
2022-07-11 23:21                         ` [PATCH v5] " Jason A. Donenfeld
2022-07-12  0:00                           ` Eric W. Biederman
2022-07-12  0:18                             ` Jason A. Donenfeld
2022-07-11 22:04                     ` Eric W. Biederman [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=87pmib9uhl.fsf@email.froward.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.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