Re:Killing processes that don't want to die
by AnIdiotOnTheNet on Tuesday September 25, 2018 @11:14AM
(#18066966)
> Keep in mind a task in `TASK_UNINTERRUPTIBLE` is already sleeping, it's not doing anything. Killing it doesn't change anything or unblock the kernel, it just removes the `task` from the scheduler.
....so why can't I force that? When you encounter this problem recovery isn't ever going to happen anyway.
Re:Killing processes that don't want to die
by wyldfire on Tuesday September 25, 2018 @11:23AM
(#18067076)
It's already in a state where it can't get back on the run list. The problem isn't that it's going to eat your CPU cycles, the problem is that it's still holding resources that you want it to give back. Taking it out of the process list won't give back those resources, it would just make it so it doesn't show up under `ps`.
> When you encounter this problem recovery isn't ever going to happen anyway.
The kernel's design can't distinguish between this unrecoverable situation and the normal functionality. Or rather it could, if it had a sane timeout. It doesn't, that's the defect.
Re:Killing processes that don't want to die
by AnIdiotOnTheNet on Tuesday September 25, 2018 @11:29AM
(#18067160)
And there's really no way around that? I find this difficult to believe, but whatever. Guess I just have to live with stuck mounts and other crap.
I don't think you really recognize the complexity here. Even if you could conceivably 'kill' the task, the kernel would still be in a broken state. It wouldn't fix the problem, it would just create a bigger one - now you have absolutely no hope of recovering as the task that could do so is gone. Keep in mind a task in `TASK_UNINTERRUPTIBLE` is already sleeping, it's not doing anything. Killing it doesn't change anything or unblock the kernel, it just removes the `task` from the scheduler.
On that note though, it's worth noting the kernel people do (or rather, did) recognize this is a problem, hence why is has already been addressed in several different ways. As mentioned above, timeouts solve the problem in most cases (And if there isn't a timeout, that's probably a bug), but the `TASK_KILLABLE` state was added around 10 years or so ago to solve this problem - as a properly written kernel task that sleeps in that state can be killed like normal and will leave the kernel in a safe state when killed.