There is some situation, when remote reboot can't be completed. True story: 1. it was a buggy kernel driver and eat almmost all memory and a lot of swap. 2. I was lucky, and loged into this machine remotly over ssh. 3. ram about 256 Mb, swap about 512 Mb. swap and ram usage over 90%. 4. Memory leak was inside kernel. 5. in reboot sequence was called swapoff. 6. OOM - killer wake up and killed reboot script/process 7. reboot stoped. The only way to bring this machine back was hardware manual non-distance reset. This isn't acceptible. I suggest: don't swap off, if there isn't enougth memory to continue. Better kill yourself (reboot process). less pain.
I really don't see what we could do about this. We definitely won't "fix" OOM killer. :=) Assigning to baselayout if they have any ideas.
The questions is: 1. it is realy important to off swap? 2. this situation can be detected and one of following steps made: a) continue with swap on b) try kill more proceses/free more memory and retry c) call /sbin/reboot -f i prefer c option.
if there was a way to determine whether it was safe to leave the swap files activated, we may disable the call to `swapoff` ... but there isnt swapfiles can be loop mount devices whose backing file is on a partition that is supposed to be unmounted, or it could be a network device that would cause a hang when the network interfaces are shut down
I understand that this situation isn't easy. But is better to have some of helper to avoid it. There can be many off scenarios when this situation occurs. It is leak in kernel space or in user space too. Let say we have big process which have eaten a lot of memory but isn't killable becouse: 1) have nfs job, but nfs are gone away. 2) working with buggy kernel drivers and are locked inside of it(read/write/ioctl) You can't kill thease proceses. But they can use a lot of memory. The worst thing is that you can't reboot your system from remote. If this is, then means that Gentoo isn't server distribution... :( The way to determine that there is enougth memory after disabling swap: used memory + memory used in swap + minimum free space < total memory if we can't disable swap, then we can do simply: reboot. it is posible to first disable these swap partitions which are 1) on network 2) on file 3) on partition
feel free to post a patch to implement said functionality