News: 1648573205

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Linux kernel patch from Google speeds up server shutdowns

(2022/03/29)


A new Linux kernel [1]patch from a Google engineer resolves a problem caused by a condition that many of us might quite like to experience – having too many NVMe drives.

The problem is caused by the relatively long time it takes to properly shut down a drive: apparently, as much as four-and-a-half seconds.

Remember [2]Sun's X4500 storage server , originally [3]codenamed Thumper ? It was truly radical when it appeared: a 3U dual-processor server, but with a stonking 48 drive bays. These days Google has a bunch of boxes with a still-fairly-impressive 16 NVMe drives attached to each one. And when they have to reboot, they take a long time.

[4]

If you have a storage server with 16 drives, that's 72 seconds of wasted time hanging around every time it reboots. Hardly an eon, but still annoying – because it's totally unnecessary.

[5]

[6]

The problem is that the kernel's drive-shutdown function is synchronous: for each drive, it waits for the shutdown command to complete before carrying on to the next. The new kernel patch does exactly the same thing, but changes the way that the calls are issued to be asynchronous. It issues the call to the first drive, then immediately moves on to the next, and works its way down the list. When they all return the desired status, the job is done.

[7]New Linux kernel bolsters random number generation

[8]Asahi Linux reaches 'very early Alpha'

[9]Linux 5.17 debuts after 'very calm' extra week of work

[10]Linus Torvalds ponders limits of automation as kernel release delayed

Presto, a minute off your reboot time. If you have more storage than Larry Page's home computer anyway.

Although this doesn't directly help most of us, sometimes these sorts of changes can have very pleasant side effects. For instance, there's a tool for kernel developers called [11]kexec which allows one kernel to load another kernel into memory and start it. This has a very desirable side effect, though: it allows you to [12]turbocharge Linux restarts. Since your computer has to spend a minute or so in its firmware, performing some self-tests and so on before it loads the operating system, if you can bypass that and just restart directly from one OS into the other, you can reboot in seconds rather than minutes. And if you're thinking that you have an SSD and bootups are super quick anyway, the effect is even more extreme with an SSD. ®

Bootnote

Like many other things, progress has made things worse, and unfortunately, installing the kexec-tools package on Ubuntu, which used to just magically work, now [13]doesn't . Do let us know if you find a working fix.

Get our [14]Tech Resources



[1] https://lore.kernel.org/lkml/20220328230008.3587975-1-tansuresh@google.com/

[2] https://www.theregister.com/2006/07/06/sun_opteron_out/

[3] https://www.theregister.com/2004/10/01/sun_thumper_revealed/

[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/storage&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2YkOBlmwqIG1OtZsyIUBwxAAAAM0&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[5] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/storage&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YkOBlmwqIG1OtZsyIUBwxAAAAM0&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[6] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_onprem/storage&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33YkOBlmwqIG1OtZsyIUBwxAAAAM0&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[7] https://www.theregister.com/2022/03/21/new_linux_kernel_has_improved/

[8] https://www.theregister.com/2022/03/21/asahi_linux_alpha/

[9] https://www.theregister.com/2022/03/20/linux_5_17/

[10] https://www.theregister.com/2022/03/14/linux_5_17_rc8/

[11] https://man7.org/linux/man-pages/man2/kexec_load.2.html

[12] https://www.tomica.net/blog/2019/03/reboot-with-kexec-on-ubuntu-18-04/

[13] https://unix.stackexchange.com/questions/621541/

[14] https://whitepapers.theregister.com/



Jim Mitchell

I don't quite understand how this article starts off talking about a kernel patch then segues into kexec and then into an Ubuntu package not working.

It's Linux

VoiceOfTruth

So if you don't like the way this article is written, fork it and do it your own way.

Re: It's Linux

Jim Mitchell

I can't find the El Reg github repo.

Re: It's Linux

jake

It's not Linux, nor is it licensed like Linux.

It's an article on ElReg, and copyright exists accordingly.

HDDs too?

Nate Amsden

is this an issue with HDDs too?(I assume it would be?) I've never noticed anyone complaining with lots of hard disks(assuming they are not abstracted by a RAID controller) complaining about slow reboot over the years.

Re: HDDs too?

SImon Hobson

Yes, it'll affect HDs too. And yes, some people have complained about reboot times even though for many it's not an everyday occurrence.

However, if you have a server farm with millions of servers, even an occasional reboot can consume a lot of time.

Why even...

chuckufarley

...let the kernel handle this stuff? Isn't this what systemd is for?

Speed up shutdowns?

jake

And here I thought the object of the game was not to have any shutdowns at all ... I'm perfectly happy waiting a minute or two on the very odd occasion that I need to shutdown a server. I guess Alphagoo anticipates many line-stopper moments out there in their cloud. I'm sure all their clients are quite happy about this.

Re: Speed up shutdowns?

Richard 12

Nope, the idea is to have the smallest possible amount of downtime.

1 minute for a single server is trivial, nobody really cares.

But 1 minute each for 100,000 servers... that's a lot of downtime.

I've figured out even quicker shutdowns

Gene Cash

Just pull the plug.

I'll be submitting a pull request tonight.

"...proper attention to Earthly needs of the poor, the depressed and the
downtrodden, would naturally evolve from dynamic, articulate, spirited
awareness of the great goals for Man and the society he conspired to erect."
-- David Baker, paraphrasing Harold Urey, in "The History of
Manned Space Flight"