Zack's Kernel News
Speeding Up Boot-Time
Nathan Zimmer noticed that on large-memory systems, booting up could take more than an hour, just due to initializing memory. He posted a patch written by himself and Mike Travis, which would cause the CPUs to start up first – that way the memory initialization could be offloaded to multiple CPUs at the same time, thus speeding up the whole process.
Greg Kroah-Hartman replied, pointing out that Nathan and Mike had made this patch a configuration option. But, Greg said, there really wasn't any reason to make it optional, because it was a pure win. Surely no one would ever choose to have a slower system for no reason.
H. Peter Anvin joined Greg in that assessment, saying that probably any system with more than a certain amount of memory – Peter guessed 128GB – would want to enable this feature by default.
Peter also wanted to know how much code this patch added to the kernel. Nathan said it was only about 400 lines of source code, but Peter clarified – he meant he was curious how many bytes of machine code the patch would add to the actual binary. To which Nathan said it was about 32KB. Peter was surprised that the patch could really be that large. He said, "Is this init code? 32K of unconditional runtime addition isn't completely trivial." Nathan replied that perhaps 24KB of it was real run-time code.
There was some back-and-forth about alternative implementations for Nathan's and Mike's idea. Yinghai Lu had some ideas, and Ingo Molnár had a proposal for a whole different concept that relied on the "buddy allocator" – a mechanism of dividing up system memory into easily handled chunks.
One way or another, though, this feature will soon be accepted into the official tree. Whether Nathan's and Mike's patch gets in, or something by Ingo, the patch will be implemented somehow. The speedup is simply too great to ignore.
Named Anonymous Memory
Colin Cross felt that certain features were just languishing in linux-next, and he wanted to see them migrate into the official tree, if possible. Specifically,
ashmem (Android Shared Memory) had some very cool features. Among them, Colin said, were the features implementing various types of anonymous memory.
Colin especially liked "named" anonymous memory – a region of memory that would show up as a file in
/proc/pid/maps. He said, "The Dalvik VM likes to use this feature extensively, even for memory that will never be shared and could easily be allocated using an anonymous mmap, and even malloc has used it in the past. It provides an easy way to collate memory used for different purposes across multiple processes, which Android uses for its 'dumpsys meminfo' and 'librank' tools to determine how much memory is used for java heaps, JIT caches, native mallocs, etc."
In addition to migrating the code out of linux-next, Colin wanted to enhance it with new system calls and other behaviors to make it more generally useful.
Christoph Hellwig was not convinced that this feature was really valuable, though. He didn't see "what ashmem buys over a shared mmap of /dev/zero." Colin replied, "ashmem ties the memory to an fd, so it can be passed to another process and mmaped to get to the same memory, but /dev/zero does not. Passing a /dev/zero fd and mmaping it would result in a brand new region of zeroed memory. Opening a tmpfs file would allow sharing memory by passing the fd, but we don't want a world-writable tmpfs."
At this point, Christoph said he was surprised that
/dev/zero didn't already do what Colin attributed to ashmem – but after looking at the
/dev/zero code, he had to affirm that ashmem represented something new.
Alex Elsayed joined the discussion, as did John Stultz, and proceeded to explore implementation details with Colin. A solid design didn't emerge in the discussion, but it seems as though at least in theory, ashmem may have some valuable qualities, worth migrating out of linux-next and into the main tree.
The Linux kernel mailing list comprises the core of Linux development activities. Traffic volumes are immense, often reaching 10,000 messages in a week, and keeping up to date with the entire scope of development is a virtually impossible task for one person. One of the few brave souls to take on this task is Zack Brown.
Buy this article as PDF
Azure CTO says Redmond has already considered the unthinkable.
Lead developer quells rumors that the Debian version is slated for center stage.
MSBuild is now just another GitHub project as Redmond continues its path to the light.
Malware could pass data and commands between disconnected computers without leaving a trace on the network.
New rules emphasize collegiality in coding.
Upstart lands in the dust bin as a new era begins for Linux.
HP's annual Cyber Risk report offers a bleak look at the state of IT.
But what do the big numbers really mean?
.NET Core execution engine is the basis for cross-platform .NET implementations.
The Xnote trojan hides itself on the target system and will launch a variety of attacks on command.