You are not logged in.

#1 2014-09-10 16:03:53

maslascher
Member
Registered: 2013-10-15
Posts: 52

Linux kernel bloated?

Hello, i was wondering lately about Linux kernel is growing from release to release and it will probably hit 100MB in next couple of years(linux has now maybe almost 80MB and initially it was few MB). Am i right this extra bloat slows performance. I know very little about Linux Kernel so i created this topic in Newbie  Corner.

Offline

#2 2014-09-10 16:19:58

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: Linux kernel bloated?

My modularized kernel Arch kernel is just shy of 4MB.  My Gentoo Kernel with all the modules built in is 5.6 MB.  With a ratio of 16.7:1, I'd say we've a way to go to get to 100MB

Edit.  Moving to GNU/Linux discussion.

Last edited by ewaller (2014-09-10 16:20:57)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-09-10 17:17:59

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Linux kernel bloated?

ewaller wrote:

...with all the modules built in is 5.6 MB...

out of curiosity does that include microcode.ko?

Mine's a bit bigger than yours (this is gzip compressed, to save 0.1second boot time vs lz4), all built in apart from:
kvm{,_intel} - a bit big, but it seems to (well, systemd probably) loads it every boot anyway
snd_usb_audio - no reason, really!
microcode - because I couldn't get it to auto-load the firmware (without doing the cpio prepend stuff, as I have no need for an initramfs)

5.9M	2014-09-07 14:28	/boot/vmlinuz-3.16.2e

I keep wanting to re-modularize cifs, and iptables... because they "feel like" they shouldn't be inbuilt for some reason!

So yes, 100MB for a sane .config doesn't seem likely for many years.

Last edited by stevenhoneyman (2014-09-10 17:23:11)

Offline

#4 2014-09-10 17:57:12

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: Linux kernel bloated?

Does the size of the kernel correlate with performance?

Offline

#5 2014-09-10 18:02:18

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Linux kernel bloated?

teateawhy wrote:

Does the size of the kernel correlate with performance?

not really (on a "current" desktop/laptop)

It's noticable for sure for boot speed, but that's under 0.25 seconds faster, it's not worth it unless you're interested in learning a lot more about linux, or need to save disk space

Offline

#6 2014-09-10 18:02:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Linux kernel bloated?

stevenhoneyman wrote:

this is gzip compressed, to save 0.1second boot time vs lz4...

Huh?  Please correct me if I'm wrong (edit: I am) but the kernel is never compressed.  If you use an initramfs/initrd that would commonly be compressed.

EDIT: Sorry Steven; Thanks 2MD

Last edited by Trilby (2014-09-10 18:09:47)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2014-09-10 18:05:36

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: Linux kernel bloated?

I don't know where this 80 MB number is coming from. I also have several kernels, all less than 6 MB. maslascher, if you are so worried about the size of the kernel, you should learn how to build a kernel optimized for your hardware.

Offline

#8 2014-09-10 18:08:05

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: Linux kernel bloated?

Trilby wrote:
stevenhoneyman wrote:

this is gzip compressed, to save 0.1second boot time vs lz4...

Huh?  Please correct me if I'm wrong, but the kernel is never compressed.  If you use an initramfs/initrd that would commonly be compressed.

Correct me if I am wrong, but I believe that "vmlinuz" means that the kernel is compressed.
https://en.wikipedia.org/wiki/Vmlinux#Etymology
http://forums.gentoo.org/viewtopic-t-90 … art-0.html

Last edited by 2ManyDogs (2014-09-10 18:11:56)

Offline

#9 2014-09-10 18:08:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Linux kernel bloated?

I suspect the 80MB comes from the kernel package size (73MB for the stock kernel - so still an exaggeration).  For the original question, the package size is completely irrelevant for everything related to performance.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2014-09-10 18:28:05

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: Linux kernel bloated?

Unrelated to Arch Linux, it is  very important to me that Linux remain small enough to be hosted on various embedded processors.  Broadcom, Maxum, Microchip, Atmel and others make various MIPS/ARM/Harvard architecture processors with a couple MB of flash and a few hundred kB of RAM.  The vast majority of Linux machines run on these embedded SOCs.  I think it is safe to assume Linux will not out grow them.

Last edited by ewaller (2014-09-10 18:28:57)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2014-09-10 18:48:15

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: Linux kernel bloated?

If your kernel is built with drivers as modules rather than built in to the kernel itself, then only the needed modules will be loaded. Kernel modules are, by and large, the default. The total size on disk is not related to the loaded kernel size.


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#12 2014-09-11 09:56:38

dakt
Member
From: Croatia
Registered: 2010-10-04
Posts: 67

Re: Linux kernel bloated?

maslascher wrote:

Hello, i was wondering lately about Linux kernel is growing from release to release and it will probably hit 100MB in next couple of years(linux has now maybe almost 80MB and initially it was few MB). Am i right this extra bloat slows performance. I know very little about Linux Kernel so i created this topic in Newbie  Corner.

There is no large software without bloat. Considering the pace and number of people involved in Linux development, it's all rainbow and pink ponies.

Offline

#13 2014-09-11 10:40:11

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Linux kernel bloated?

I think most of this growth in lines of code comes from drivers for new hardware or platform support, etc. These do not add much complexity to the kernel architecture, as they are modularized, so don't be too worried.
As others have already said, the runtime penalty is also very little, as only the modules you need will be loaded.


This silver ladybug at line 28...

Offline

#14 2014-09-11 18:00:20

maslascher
Member
Registered: 2013-10-15
Posts: 52

Re: Linux kernel bloated?

When it comes to size i was only referring to package weight, i am total newbie when it come to kernel knowledge. But if package has nothing to do with kernel size in working system and it is just this 4 MB than i am okay with that.
Initially i was thinking that all package size is loaded on startup (which gives extra second of load on spinning hard drive) and modules are just turned off and on in case if needed and i was so wrong. I didn't found any article in Internet about it and also i am just average user.
Thank you all for clarifications, much appreciate.

Offline

#15 2014-09-11 19:51:42

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Linux kernel bloated?

maslascher wrote:

When it comes to size i was only referring to package weight, i am total newbie when it come to kernel knowledge. But if package has nothing to do with kernel size in working system and it is just this 4 MB than i am okay with that.
Initially i was thinking that all package size is loaded on startup (which gives extra second of load on spinning hard drive) and modules are just turned off and on in case if needed and i was so wrong. I didn't found any article in Internet about it and also i am just average user.
Thank you all for clarifications, much appreciate.

Try this:

lsmod|awk '{t+=$2;} END {printf("%4.2f MB of loaded modules\n",t/1024/1024);}'

lsmod lists loaded modules (and their sizes). that ^^ just adds them all up. combine that with the size of  /boot/vmlinuz-linux  and you've got a rough idea of how much of a "size" it takes up

Offline

#16 2014-09-21 18:28:35

MadmanRB
Member
From: Like I will tell you
Registered: 2014-08-07
Posts: 80

Re: Linux kernel bloated?

On my system I see Linux kernel is about 80MB, but it doesnt bother me as on my desktop I got plenty of room (I got a 1 TB HDD, 80MB is peanuts)


A keen mind goes a long way...

Offline

#17 2014-09-21 18:30:16

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Linux kernel bloated?

MadmanRB wrote:

On my system I see Linux kernel is about 80MB

I'm pretty sure it isn't. Have you read the posts above?

Offline

#18 2014-09-21 18:38:05

MadmanRB
Member
From: Like I will tell you
Registered: 2014-08-07
Posts: 80

Re: Linux kernel bloated?

stevenhoneyman wrote:
MadmanRB wrote:

On my system I see Linux kernel is about 80MB

I'm pretty sure it isn't. Have you read the posts above?

According to the readouts on pacman and its front ends.
The actual size is about 71.48MB according to pamac (just using pamac as a update notifier here I can use commandline folks) but as stated this may be blind guessing as the headers is 3.16MB
Plus I do have some drivers here for my hardware so it does make sense the large size.


A keen mind goes a long way...

Offline

#19 2014-09-21 18:39:56

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Linux kernel bloated?

Quick comparison:

empty@Arch ~ % ls -lh /boot
-rwxr-xr-x 1 root root 3.8M Sep 17 20:57 vmlinuz-linux* # Arch (standard)
-rwxr-xr-x 1 root root 3.0M Sep 13 08:22 vmlinuz-3.16-1-amd64* # Debian Sid

Arch looks a bit bloaty to me...
tongue

Offline

#20 2014-09-21 18:40:45

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Linux kernel bloated?

MadmanRB wrote:
stevenhoneyman wrote:
MadmanRB wrote:

On my system I see Linux kernel is about 80MB

I'm pretty sure it isn't. Have you read the posts above?

According to the readouts on pacman and its front ends.

...that's a no then tongue

Offline

#21 2014-09-21 18:42:18

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Linux kernel bloated?

Head_on_a_Stick wrote:

Quick comparison:

empty@Arch ~ % ls -lh /boot
-rwxr-xr-x 1 root root 3.8M Sep 17 20:57 vmlinuz-linux* # Arch (standard)
-rwxr-xr-x 1 root root 3.0M Sep 13 08:22 vmlinuz-3.16-1-amd64* # Debian Sid

Arch looks a bit bloaty to me...
tongue

Are both of those gzip compressed distro stock kernels?

If you're using an SSD, sometimes smaller != faster

Offline

#22 2014-09-21 18:45:08

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Linux kernel bloated?

@MadmanRB: The linux package contains the stock Arch kernel, plus all modules built for it. Since the stock build is aimed at the broadest hardware compatibility, the package contains many, many more modules than are actually needed for any individual system:

$ pacman -Ql linux-lts | wc -l
4117

The kernel (and whatever modules your system loads) will be a tiny fraction of the package size.

Offline

#23 2014-09-21 18:46:06

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Linux kernel bloated?

@stevenhoneyman -- both bog stock (I'm just an amateur)

Offline

#24 2014-09-21 19:08:47

MadmanRB
Member
From: Like I will tell you
Registered: 2014-08-07
Posts: 80

Re: Linux kernel bloated?

ANOKNUSA wrote:

@MadmanRB: The linux package contains the stock Arch kernel, plus all modules built for it. Since the stock build is aimed at the broadest hardware compatibility, the package contains many, many more modules than are actually needed for any individual system:

$ pacman -Ql linux-lts | wc -l
4117

The kernel (and whatever modules your system loads) will be a tiny fraction of the package size.

No I did guess that, but again not like I mind as the size is tiny on my harddisk.


A keen mind goes a long way...

Offline

#25 2014-09-21 20:54:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Linux kernel bloated?

Gents - lets please not try talking around each other.  There are clearly two (or maybe three) metrics of kernel "size" being discussed here: 1) there is the compiled-code size that is used in order for the kernel to run - this is basically the size column of `ls -l /boot` output; 2) there is also the size-on-disk of the kernel package; and perhaps 3) there is the compiled-code size which would account for the various modules that are currently in use.

If MadmanRB is saying the ~80MB is of no concern as he has TBs of disk space, then it seems clear to me that he is referring to the second meaning of 'size'.  Whether you think package size means anything at all, it's rather ironic to suggest MadmanRB is not paying attention because he is not using definition 1 or 3: definition 2 is the only reasonable one to work with if drive space is the concern.

@ MadmanRB, some of this may be brought on as drive space, nowadays, is rarely a limiting factor.  So "bloat" will often refer more to metrics about size of the compiled code binaries, and the memory that they require both for code space and data allocation (typical memory use).  I suspect many users here are baffled by your focus on size-on-disk of the entire kernel package especially since you have TBs to work with.  The ~80MB package size is simply not relevant in most peoples minds when they consider the size of the "kernel".

EDIT: oops - it seems I had confused who the OP in this thread was.  It seems the OP is satisfied and not concerned.  So perhaps this thread should just be left alone.

Last edited by Trilby (2014-09-21 23:48:52)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB