Re: [GIT PULL] io_uring fixes for 5.12-rc3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/12/21 2:24 PM, Linus Torvalds wrote:
> On Fri, Mar 12, 2021 at 1:17 PM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux