tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Unused functions in kernels
On Sat, Jun 04, 2016 at 07:08:43PM +0200, Krister Walfridsson wrote:
> I'm doing a small investigation of NetBSD code bloat (see my blog post
> http://kristerw.blogspot.se/2016/05/20-years-of-netbsd-code-bloat.html for
> some background), and I noticed that the kernels have a fair amount of
> unused code -- for example, 7% of the sun3 GENERIC kernel consists of
> functions that do not have any callers.
A lot of this are generic interfaces that may or may not be used by a
platform. Going down and conditionalizing pieces seems to be just asking
for maintainance trouble for little to no gain.
> I'm not sure how much of this is reasonable to eliminate -- many are trivial
> functions that do not contribute much to the size, but there are a number of
> larger pieces that probably should be removed (for example,
> all callers of ip6_forward.c are within #if 0 blocks, so ip6_forward.c could
> be removed from files.netinet6)
Even then, I'd argue that it is the wrong approach. We have too much
conditionals already. A better approach would be to just use
-ffunction-sections -fdata-sections and link with -Wl,--gc-sections.
Joerg
Home |
Main Index |
Thread Index |
Old Index