public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Linus Torvalds <[email protected]>
Cc: io-uring <[email protected]>
Subject: Re: [GIT PULL] io_uring fixes for 5.12-rc3
Date: Fri, 12 Mar 2021 14:33:09 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHk-=wj3gu-1djZ-YPGeUNwpsQzbCYGO2j1k_Hf1zO+z5VjSpA@mail.gmail.com>

On 3/12/21 2:24 PM, Linus Torvalds wrote:
> On Fri, Mar 12, 2021 at 1:17 PM Linus Torvalds
> <[email protected]> wrote:
>>
>> I'm _guessing_ it's just that now those threads are user threads, and
>> then the freezing logic expects them to freeze/thaw using a signal
>> machinery or something like that. And that doesn't work when there is
>> no signal handling for those threads.
> 
> IOW, I think it's this logic in freeze_task():
> 
>         if (!(p->flags & PF_KTHREAD))
>                 fake_signal_wake_up(p);
>         else
>                 wake_up_state(p, TASK_INTERRUPTIBLE);
> 
> where that "not a PF_KTHREAD" test will trigger for the io_uring
> threads, and it does that fake_signal_wake_up(), and then
> signal_wake_up() does that
> 
>         set_tsk_thread_flag(t, TIF_SIGPENDING);
> 
> but the io_uring thread has no way to react to it.
> 
> So now the io_uring thread will see "I have pending signals" (even if
> there is no actual pending signal - it's just a way to get normal
> processes to get out of TASK_INTERRUPTIBLE and return to user space
> handling).
> 
> And the pending fake signal will never go away, because there is no
> "return to user space" handling.
> 
> So I think the fix is to simply make freeze_task() not do that fake
> signal thing for IO-uring threads either.

Ah good catch, I missed it. Yes I bet this is exactly what it is, and
it just needs the one liner doing:

         if (!(p->flags & (PF_IO_WORKER | PF_KTHREAD)))
                 fake_signal_wake_up(p);
         else
                 wake_up_state(p, TASK_INTERRUPTIBLE);

instead. I'll try this out and test it, then we can drop the PF_NOFREEZE
business going forward. Thanks!

-- 
Jens Axboe


  parent reply	other threads:[~2021-03-12 21:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 19:48 [GIT PULL] io_uring fixes for 5.12-rc3 Jens Axboe
2021-03-12 21:17 ` Linus Torvalds
2021-03-12 21:24   ` Linus Torvalds
2021-03-12 21:25     ` Linus Torvalds
2021-03-12 21:34       ` Linus Torvalds
2021-03-12 21:35         ` Jens Axboe
2021-03-12 21:33     ` Jens Axboe [this message]
2021-03-12 21:31   ` Jens Axboe
2021-03-12 21:52 ` pr-tracker-bot

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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