LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   What's your kernel size? (http://www.linuxquestions.org/questions/linux-general-1/whats-your-kernel-size-773683/)

Ygrex 12-05-2009 01:04 PM

What's your kernel size?
 
Unlike previous threads (2005 and 2004), please, note the total kernel size (or sizes:hattip:). I think, desktop-oriented only stations should be presented here :)
  • Firstly, disk usage:
    Code:

    # LC_MESSAGES=C du -shc /boot/vmlinuz-2.6.32 /boot/initramfs-2.6.32 /lib/modules/2.6.32
    1,3M    /boot/vmlinuz-2.6.32
    3,3M    /boot/initramfs-2.6.32
    9,6M    /lib/modules/2.6.32
    15M    total

    OK, my kernel consumes 15Mb on the HDD
  • Secondly, tipical number of loaded modules:
    Code:

    # wc -l /proc/modules
    75 /proc/modules

    therefore, mostly I use 75 modules
  • The number of loaded modules can be compared to the total compiled modules number:
    Code:

    $ find /lib/modules/2.6.32/ -name '*.ko' | wc -l
    315

    I have 315 modules ready to work
  • And the last point is a RAM usage. I am not sure how to measure it precisely, but I've summarized these ranges:
    Code:

    $ cat /proc/iomem | grep -wi kernel
      01000000-011fc069 : Kernel code
      011fc06a-012b64e7 : Kernel data
      012f5000-01317493 : Kernel bss

    a little bash-trick to calculate it:
    Code:

    $ echo $(( $(cat /proc/iomem | grep -wi kernel | sed -r 's#^\s*([0-9a-f]+)-([0-9a-f]+)\s+:.*$#0x\2 - 0x\1 +#') 0 ))
    2984313

    it seems like a truth, so my kernel is 2.84Mb in RAM

Then, how fat is your kernel?

jhwilliams 12-05-2009 02:57 PM

I'll play.

Kernel size on disk:
Code:

du -hsc /boot/vmlinuz-2.6.31-15-generic /boot/initrd.img-2.6.31-15-generic /lib/modules/2.6.31-15-generic/
3.8M        /boot/vmlinuz-2.6.31-15-generic
7.8M        /boot/initrd.img-2.6.31-15-generic
98M        /lib/modules/2.6.31-15-generic/
110M        total

Loaded modules:
Code:

lsmod | wc -l
77

Available modules:
Code:

find /lib/modules/2.6.31-15-generic/ -name "*.ko" | wc -l
2472


alunduil 12-05-2009 03:04 PM

This ought to be fun.

Kernel Size on Disk:
Code:

du -hsc /boot/bzImage-2.6.32-gentoo /boot/config-2.6.32-gentoo /boot/System.map-2.6.32-gentoo
2.6M    /boot/bzImage-2.6.32-gentoo
58K    /boot/config-2.6.32-gentoo
1.6M    /boot/System.map-2.6.32-gentoo
4.2M    total

Loaded Modules:
Code:

lsmod | wc -l
26

Available Modules:
Code:

find /lib/modules/2.6.32-gentoo/ -name "*.ko" | wc -l
42

Regards,

Alunduil

MrCode 12-05-2009 05:42 PM

I'm such a sucker/n00b/(insert insulting name here)... :(

Code:

mrcode@linuxbox:~$ find /lib/modules/2.6.28-16-generic -name "*.ko" | wc -l
2315
mrcode@linuxbox:~$ lsmod | wc -l
64

Any way to know which ones I actually need? 64 loaded modules is a bit *ridiculous*, isn't it?

And regarding the available modules... :eek: :eek:

Didn't know I had so much bloat...

XavierP 12-05-2009 06:01 PM

Kernel Size on Disk
Code:

3.8M    /boot/vmlinuz-2.6.31-16-generic
81M    /lib/modules/2.6.31-16-generic
84M    total

Loaded Modules
Code:

52 /proc/modules
Loaded v Compiled
Code:

find /lib/modules/2.6.31-16-generic/ -name '*.ko' | wc -l
2665

RAM usage
Code:

cat /proc/iomem | grep -wi kernel
  00100000-00575b93 : Kernel code
  00575b94-0078d3c7 : Kernel data
  0081a000-008a809f : Kernel bss

+ Bash calculation
Code:

echo $(( $(cat /proc/iomem | grep -wi kernel | sed -r 's#^\s*([0-9a-f]+)-([0-9a-f]+)\s+:.*$#0x\2 - 0x\1 +#') 0 ))

7451749

This is using Kubuntu Karmic Koala (v9.10), so it may be a bit bloaty...

MrCode 12-05-2009 06:09 PM

Quote:

Originally Posted by XavierP (Post 3781255)
Loaded Modules
Code:

52 /proc/modules
Loaded v Compiled
Code:

find /lib/modules/2.6.31-16-generic/ -name '*.ko' | wc -l
2665


Okay, so I guess I shouldn't put myself down so much...apparently it's Ubuntu's fault, not mine (I'm running 9.04 Jaunty, btw).

And what horrible gibberish is this?

Quote:

Code:

sed -r 's#^\s*([0-9a-f]+)-([0-9a-f]+)\s+:.*$#0x\2 - 0x\1 +#') 0 ))

I can kind of make out what you did, but that syntax is still like reading Chinese to me...then again, I'm still a n00b, so I guess I shouldn't really care (for now).

Ygrex 12-06-2009 02:27 AM

Quote:

Originally Posted by MrCode (Post 3781258)
it's Ubuntu's fault, not mine (I'm running 9.04 Jaunty, btw).

it's OK for precompiled kernels, for they must be universal and run on any machine
Quote:

Originally Posted by MrCode (Post 3781258)
I can kind of make out what you did, but that syntax is still like reading Chinese to me...

it does nothing more than filters content of /proc/iomem and composes an arithmetic expression for bash; nothing horrible! (here's a chapter about "Chinese" itself)

Thanks to anyone! I hope we'll see abit more results here

H_TeXMeX_H 12-06-2009 07:04 AM

Code:

bash-3.1$ du -shc /boot/vmlinuz /lib/modules/2.6.29.6
2.1M        /boot/vmlinuz
46M        /lib/modules/2.6.29.6
48M        total
bash-3.1$ wc -l /proc/modules
58 /proc/modules
bash-3.1$ find /lib/modules/2.6.29.6 -name '*.ko' | wc -l
1049
bash-3.1$ echo $(( $(cat /proc/iomem | grep -wi kernel | sed -r 's#^\s*([0-9a-f]+)-([0-9a-f]+)\s+:.*$#0x\2 - 0x\1 +#') 0 ))
4670901


mlangdn 12-06-2009 07:14 AM

I'll give this a go as well on my custom kernel.

Code:

# LC_MESSAGES=C du -shc /boot/vmlinuz-2.6.31.1 /boot/initramfs-2.6.31.1 /lib/modules/2.6.31.1
2.1M    /boot/vmlinuz-2.6.31.1
du: cannot access `/boot/initramfs-2.6.31.1': No such file or directory
20M    /lib/modules/2.6.31.1
22M    total

Code:

wc -l /proc/modules
50 /proc/modules

Code:

find /lib/modules/2.6.31.1/ -name '*.ko' | wc -l
190

Code:

cat /proc/iomem | grep -wi kernel
  01000000-0131f590 : Kernel code
  0131f591-0146dc57 : Kernel data
  014ea000-0151f487 : Kernel bss

Code:

echo $(( $(cat /proc/iomem | grep -wi kernel | sed -r 's#^\s*([0-9a-f]+)-([0-9a-f]+)\s+:.*$#0x\2 - 0x\1 +#') 0 ))
4862173



All times are GMT -5. The time now is 01:15 PM.