Splicing out syscalls for tiny kernels
The latest example comes from Pieter Smith's patch set to remove support for the splice() family of system calls, including sendfile() and tee(). There will be many tiny systems with dedicated applications that have no need for those calls; removing them from the kernel makes 8KB of memory available for other purposes. The Linux "tinification" developers see that as a worthwhile gain, but some others disagree.
In particular, David Miller opposed the
change, saying "I think starting to compile out system calls is a
very slippery slope we should not begin the journey down.
" He
worries that, even if a specific system works today without
splice(), there may be a surprise tomorrow when some library
starts using that system call. Developers working on Linux systems, David
appears to be arguing, should be able to count on having the basic system
call set available to them anywhere.
The tinification developers have a couple of answers to this concern. One is that developers working on tiny systems know what they are doing and which system calls they can do without. As Josh Triplett put it:
The other response is that the kernel has, in fact, provided support for compiling out major subsystems since the beginning. Quoting Josh again:
(This list goes on for some time; see the original mail for all the details). Eric Biederman added that the SYSV IPC system calls have been optional for a long time, and Alan Cox listed more optional items as well. David finally seemed to concede that making system calls optional was not a new thing for the Linux kernel, but he stopped short of actually supporting the splice() removal patch.
Without his opposition, though, this patch may go in. But a look at the kernel tinification project list makes it clear that this discussion is likely to return in the future. The tinification developers would like to be able to compile out support for SMP systems, random number generation, signal handling, capabilities, non-root users, sockets, the ability for processes to exit, and more. Eventually, they would like to have an automated tool that can examine a user-space image and build a configuration removing every system call that the given programs do not use.
Needless to say, any kernel that has been stripped down to that extent will not resemble a contemporary Linux system. But, on the other hand, neither do the ancient (but much smaller) kernels that these users often employ now. If Linux wants to have a place on tiny systems, the kernel will have to adapt to the resource constraints that come with such systems. That will bring challenges beyond convincing developers to allow important functionality to be configured out; the tinification developers will also have to figure out a way to allow this configuration without introducing large numbers of new configuration options and adding complexity to the build system.
It looks like a hard line to walk. But the Linux kernel embodies the
solution to a lot of hard problems already; where there are willing
developers, there is usually a way. If the tinification developers can
find a way here, Linux has a much better chance of being present on the
tiny systems that are likely to be embedded in all kinds of devices in the
coming years. That seems like a goal worth trying for.
| Index entries for this article | |
|---|---|
| Kernel | Embedded systems |
Posted Dec 4, 2014 3:13 UTC (Thu)
by dw (subscriber, #12017)
[Link]
Improving modularization of the kernel in the short term may eventually lead it to remaining competitive with application designs optimized either for extreme efficiency (as we already see in commercial settings -- e.g. HFT, process control) or containerization (assuming at some point, compute time is no longer sold in quantities as brutally coarse as double-digit percentage slices of the host machine).
Posted Dec 4, 2014 7:29 UTC (Thu)
by eru (subscriber, #2753)
[Link] (3 responses)
Posted Dec 4, 2014 8:05 UTC (Thu)
by dlang (guest, #313)
[Link] (2 responses)
Posted Dec 7, 2014 23:06 UTC (Sun)
by liam (guest, #84133)
[Link] (1 responses)
Posted Dec 8, 2014 16:38 UTC (Mon)
by rgmoore (✭ supporter ✭, #75)
[Link]
I think the whole idea is that the parts you need would still work. This is for really tiny, hardware-constrained embedded applications. That means that both the hardware and software are tightly defined, and it should be relatively easy to list exactly which features of the kernel are ever used. If the tools for listing used features and removing unneeded ones are well written, trimming the kernel to the bare minimum should be simple enough to be part of a standard development process.
Posted Dec 4, 2014 13:43 UTC (Thu)
by epa (subscriber, #39769)
[Link] (1 responses)
Posted Dec 17, 2014 19:45 UTC (Wed)
by tbird20d (subscriber, #1901)
[Link]
Splicing out syscalls for tiny kernels
Splicing out syscalls for tiny kernels
Splicing out syscalls for tiny kernels
Splicing out syscalls for tiny kernels
Splicing out syscalls for tiny kernels
8 kilobytes of memory
removing them from the kernel makes 8KB of memory available for other purposes.
Is that because the kernel code is 8Kbyte smaller or because the working memory needed by the kernel is less? Or a combination of both? (It might matter if some embedded systems want to put the kernel in ROM, I guess.)
8 kilobytes of memory
