tech-kern archive

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

Re: unconfiguring swap at shutdown

On Tue, Sep 02, 2008 at 03:52:20PM -0700, Jason Thorpe wrote:
>> A lot of the unkillable processes I've seen are stuck deep inside some
>> device driver, waiting for an even that either will never happen or
>> which could happen but which is difficult to arrange for.
> Yes, they're waiting for an event... using some facility provided by the 
> kernel... condvars or tsleep... meaning the kernel could awaken the thread 
> and cause it to commit suicide.

It's not that simple. Processes end up unkillable because they're in
an uninterruptible wait. If you interrupt the uninterruptible wait,
there's no recovery and cleanup code. So you're pretty much limited to
taking the process out of the process table and dropping it on the
floor; but that doesn't really accomplish anything.

The only remotely viable approach to this problem is to never (or as
never as possible) have uninterruptible waits, and then you never have
unkillable processes. However, it's not exactly trivial sometimes, and
it'd be quite nontrivial to refit the entire kernel, because someone
has to go write all that error handling code.

Is there something else you have in mind that I haven't thought of?

For the immediate problem it would be a lot easier to add a forced
swapoff operation: discard all the pages in the swap file, replace
them with zero-fill pages, and post SIGKILL to all the affected
processes. This would maybe even be useful in other situations,
e.g. swap over nfs to a dead server. It's nonetheless not exactly
trivial and I'm certainly not volunteering.

David A. Holland

Home | Main Index | Thread Index | Old Index