Kmorph Prototype: Linux Standby Kernel Takes Over Without Reboot

A Linux server whose kernel – the core of the operating system – crashes stays down until it is rebooted. A technical article on the Habr portal puts a full reboot at up to several minutes. This is where Kmorph comes in, a tool by Linux developer Cong Wang: a second kernel already runs in the background, on a few dedicated processor cores and part of the memory, and takes over the machine as soon as the first one fails. According to Wang's announcement, about one second passes between fault detection and the successor running.
The enabling mechanism is an extension called Multikernel: several Linux kernels run in parallel on the same machine, each with its own processor cores, memory areas and devices, without a virtualization layer. If the old kernel goes silent – according to Hwbusters after five consecutive unanswered checks, by default half a second apart – the successor freezes the old processor cores and checks whether they have actually stopped. This stopping, known in technical jargon as fencing, prevents both kernels from accessing the same resources. If the takeover fails within ten seconds, the old kernel thaws everything and stays in service. On request, Kmorph also saves a memory image of the crash; the project on GitHub describes it as a replacement for the usual kdump.
The figure of two seconds comes from a test by the developers themselves: a prepared Nginx web server responded to requests again afterwards. The limits are spelled out. Services started in advance in the standby kernel must not write persistent state before the takeover and must not touch the network – Kmorph cannot verify this itself. Services running in their own sandbox must be restarted by the successor after the switch. The specialist site LWN.net, which documents the code as a Request for Comments (RFC), calls the tests limited: they ran only on the author's development machine, with hard-coded startup parameters. Linuxsecurity notes that it is not proven what happens to each application during the takeover, and that a production system without lost data or dropped connections has not yet been demonstrated. Phoronix adds that Kmorph is currently not part of the mainline Linux kernel, and it remains open whether the Multikernel code will make it there.
For operators of servers where every reboot costs minutes of service time, the key point is shortening this downtime. The same route is meant to handle planned kernel updates: the takeover can be triggered with kmorph upgrade while the old kernel still works. The successor can run a newer kernel version, and a planned switch produces no crash dump. The team has not yet announced a supported production release.
Clement Verna presented a further practical test in the Fedora project forum. He builds a Fedora 45 bootc image, a system image, with the Multikernel kernel and Kmorph; the helper program kmorph-bootc prepares the successor. Terminal recordings show the takeover after a crash triggered via SysRq and the switch to a new image with a new kernel version. The test ran in a virtual machine with two vCPUs and 16 GB of memory on a Graviton3 machine, with SELinux, a system security feature, disabled. Only one switch is possible per system boot. Verna explicitly calls it a proof of concept.
The next step is the one Wang himself names: fully uninterrupted operation, which he is pursuing as a development goal. Whether the Multikernel extensions will ever make it into the mainline kernel remains open.
Sources — read the originals(Paris time)
Pages consulted while writing
Read next
Comments
Loading the thread…
Sign in to leave a comment. Sign in