LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-05-2009, 01:04 PM   #1
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
What's your kernel size?


Unlike previous threads (2005 and 2004), please, note the total kernel size (or sizes). 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?
 
Old 12-05-2009, 02:57 PM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
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
 
Old 12-05-2009, 03:04 PM   #3
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
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
 
Old 12-05-2009, 05:42 PM   #4
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
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...

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

Last edited by MrCode; 12-05-2009 at 05:48 PM.
 
Old 12-05-2009, 06:01 PM   #5
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
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...
 
Old 12-05-2009, 06:09 PM   #6
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by XavierP View Post
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).

Last edited by MrCode; 12-05-2009 at 06:12 PM.
 
Old 12-06-2009, 02:27 AM   #7
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Original Poster
Rep: Reputation: 68
Quote:
Originally Posted by MrCode View Post
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 View Post
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
 
1 members found this post helpful.
Old 12-06-2009, 07:04 AM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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
 
Old 12-06-2009, 07:14 AM   #9
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,845

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Increasing Kernel stack size to 8k without recompiling the Kernel deathman Linux - Software 2 04-08-2006 04:39 AM
What's the size of your kernel? kornerr General 20 06-06-2005 06:10 AM
Kernel size ghight Linux - Software 2 10-22-2004 02:56 PM
how to know size of kernel govindabkari Linux - Software 3 08-25-2004 02:43 AM
2.6.6 Kernel size plan9 Slackware 1 06-08-2004 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration