Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel size
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Sun Nov 04, 2012 2:10 pm    Post subject: Kernel size Reply with quote

My dailyuse laptop kernel which is extramely functional, but in my optinion, fairly stripped down is 3.5M compressed or 5.5M uncompressed.
What can I compare this to. is this kernel small medium large?
I've hunted around on the internet and while there are plenty of guides on how to shrink your kernel. none really give a target.

how small is small?
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8933

PostPosted: Sun Nov 04, 2012 2:13 pm    Post subject: Reply with quote

It's reasonably small.

Actually quite similar to mine, LZO compressed:
Code:
3,4M    /boot/kernel-3.6.5-ownage
4,8M    /lib/modules/3.6.5-ownage


Look here: https://forums.gentoo.org/viewtopic-t-940702.html
Back to top
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Sun Nov 04, 2012 2:43 pm    Post subject: Reply with quote

I used xz compression because it seemed to be a good balance of speed and compression ratio.
At this point it's pretty os specific. The only other changes I could see making would be to remove some of the kernel hacking options like printk

or to internalize certain modules. such as ath9k, udf. Does that actually improve kernel size if you are able to turn off loadable modules?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21490

PostPosted: Sun Nov 04, 2012 4:56 pm    Post subject: Reply with quote

mreff555 wrote:
Does that actually improve kernel size if you are able to turn off loadable modules?
The kernel module loading code is only needed if you support loadable modules, so in theory, yes, disabling module support can reduce the size of the kernel binary. It may not be reduced by a large amount, and it could be a net loss if disabling module support forces you to include rarely used code in the core image instead of placing it in an unloaded module.
Back to top
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Sun Nov 04, 2012 8:15 pm    Post subject: Reply with quote

Just to see what would happen I updated my kernel config, adjusted every module I could find to compile in to the kernel

I've been running on it for a few hours. lsmod confirms I have no modules loaded. wireless seems to be fine.
The only problem I've noticed is that 1-wire functionality seems to have stopped since I switched it to a module (battery monitor)
I'll have to play with that one.

anyway, my kernel size increased from compressed 3.5 to 3.7. If I removed loadable modules would it drop my kernel size be more than .2M or would it be better to just go back to a couple loadable modules.
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Sun Nov 04, 2012 10:39 pm    Post subject: Reply with quote

if you're dealing with wireless, i would lean heavily towards at the very least having wireless handled via modules

as kernel releases go, wireless seems to regularly shit the bed from one release to the next. In my case, with iwlwifi, I run into situations where iwlwifi segfaults, and my only recourse is to either reboot the machine, or, much more desirable, rmmod and modprobe (trying out different parameters/args from modinfo, some of which seem to have help).

sound cards are another one. Being able to pass args to modprobe is much easier than having to specify a bunch of crap on the kernel command line.

becomes almost a philosophical discussion of "to module, or not to module". For laptops, i lean module. For servers, i tend to have everything built in.

FWIW, my kernel is 4.0M, gzipped, my modules are 4.2M. I don't really notice any superfluous bloat.
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Sat Nov 10, 2012 2:24 am    Post subject: Reply with quote

Yep, for now I've decided leaving some drivers such as wireless and video is definitely the best.
I did some more tweaking and I'm down to 3.4 compressed or 5.4 uncompressed. Removing loadable modules and building in my wifi and video cards pushes the uncompressed size up to 6.8megs
Back to top
View user's profile Send private message
wagglet
n00b
n00b


Joined: 12 Oct 2012
Posts: 4
Location: Rotorua, New Zealand

PostPosted: Sat Nov 10, 2012 9:15 am    Post subject: Reply with quote

I'm running an almost-monolithic kernel on my venerable-but-oh-so-reliable ThinkPad and since the upgrade from 3.3.8 to 3.5.7 I have to say it seems just a little snappier. I did notice a moderate size increase between the versions: it's gone up around 300K but I still think it is a reasonable size given very nearly everything is compiled-in (including WiFi firmware):-

Kernel (gzip compressed):-
Code:

-rw-r--r--  1 root root 934K Nov 10 14:55 initramfs-genkernel-x86-3.5.7-gentoo
-rw-r--r--  1 root root 5.0M Nov 10 14:46 kernel-linux-3.5.7-gentoo

Modules usually running:-
Code:

Module                  Size  Used by
vboxnetadp             18790  0
vboxnetflt             15965  0
vboxdrv               191664  2 vboxnetadp,vboxnetflt
hdaps                   6344  1
tp_smapi               12500  0
thinkpad_ec             3907  2 hdaps,tp_smapi
scsi_wait_scan           483  0

I have no complaints so far...seems stable as a rock. Perhaps my standards are too low lol :)
Back to top
View user's profile Send private message
mconnolly
n00b
n00b


Joined: 10 Nov 2012
Posts: 5
Location: Altamonte Springs, FL

PostPosted: Sat Nov 10, 2012 3:37 pm    Post subject: Reply with quote

My kernel is set up to be entirely monolithic (no modules loaded), and right now the kernel is 4MB, XZ compressed (version 3.6.6). I am going to tweak it some more, as I know I haven't done all the optimization I can. It's almost there, though.

Boot up is very quick (<10 seconds) and it's very snappy, although I have a SATA3 SSD in my computer so that's most of it there, I am sure.
Back to top
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Wed Nov 14, 2012 4:11 am    Post subject: Reply with quote

mconnolly wrote:
My kernel is set up to be entirely monolithic (no modules loaded), and right now the kernel is 4MB, XZ compressed (version 3.6.6). I am going to tweak it some more, as I know I haven't done all the optimization I can. It's almost there, though.

Boot up is very quick (<10 seconds) and it's very snappy, although I have a SATA3 SSD in my computer so that's most of it there, I am sure.


Impressive. I'm curious to know what you have removed. I'm not really sure what I could remove without sacrificing daily performance. What if any kernel hacking have you done?

here is mine
compressed and uncompressed kernel
Code:

-rw-r--r-- 1 root root 3.5M Nov  7 20:08 /boot/vmlinuz-3.6.6-build5


-rwxr-xr-x 1 root root 5.5M Nov  7 19:55 /usr/src/linux/arch/x86/boot/compressed/vmlinux


Typical modules loaded
Code:

Module                  Size  Used by
i915                  479963  2
drm_kms_helper         24749  1 i915
intel_agp              10432  1 i915
ath9k                 148831  0
ath9k_common            1834  1 ath9k
ath9k_hw              382901  2 ath9k,ath9k_common
ath                    15242  3 ath9k,ath9k_common,ath9k_hw
intel_gtt              15069  2 i915,intel_agp
coretemp                5862  0
mxm_wmi                 1305  0
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Wed Nov 14, 2012 6:31 am    Post subject: Reply with quote

Well, kernel size is continously growing. Mine has reached 2.6 Mb, I remember how it started crossing 2Mb somewhere around 2.6.32
Back to top
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Sat Aug 31, 2013 6:21 pm    Post subject: Reply with quote

I think the kernel may have shrunk somewhere around 3.7.x or 3.8.x because after that it became easier to keep it small. I gave up on a monolithic kernel because certain programs seem to require a module. Here's what I am down to now

Code:

-rw-r--r--  1 root root 3.1M Aug 30 20:18 kernel-3.10.9-gentoo-r00


Of course I do load a lot of modules these days. Still boots really fast.

Code:

Module                  Size  Used by
i915                  563019  -2
iwldvm                126992  -2
mac80211              385534  -2
fbcon                  37398  -2
bitblit                 4945  -2
uvcvideo               69996  -2
softcursor              1189  -2
snd_hda_codec_realtek    34582  -2
font                    7276  -2
tileblit                2029  -2
drm_kms_helper         27435  -2
cfbfillrect             3794  -2
cfbimgblt               2055  -2
cfbcopyarea             3270  -2
iwlwifi                74152  -2
fb                     50009  -2
cfg80211              355207  -2
videobuf2_vmalloc       2808  -2
videobuf2_memops        1743  -2
videobuf2_core         26897  -2
videodev              101088  -2
fbdev                    750  -2
atl1c                  33572  -2
snd_hda_intel          31543  -2
snd_hda_codec         130577  -2
snd_hwdep               5718  -2
snd_pcm                75054  -2
snd_page_alloc          6694  -2
snd_timer              18041  -2
snd                    56480  -2

Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 139

PostPosted: Sat Aug 31, 2013 8:31 pm    Post subject: Reply with quote

i915, atl1c, snd... as a modules, really?
What's the benefit of that besides artificially smaller kernel?

ps. My vanilla 3.10.9 with LZO compression has 4.4M.
_________________
Vanitas vanitatum et omnia vanitas.
Libera temet ex inferis.
Back to top
View user's profile Send private message
TheLexx
Tux's lil' helper
Tux's lil' helper


Joined: 04 Dec 2005
Posts: 137
Location: Austin Tx

PostPosted: Sun Sep 01, 2013 1:30 am    Post subject: Reply with quote

I've always leaned towards a more modular kernel. I used kernel-seeds and "make localmodconfig" along with my own script that 'merged' multiple ".config" files to come up with my .config file.

All my human interface devices are USB so built in enough USB such that Keyboards, mice and thumb drives can be read w/o any modules loaded. I compile a single kernel to run all my computers. They run on single core, but the most intense computing I do is play youtube and mp3.



ls -l kmh-bzImage-3.4.48-1 -> 2.19M
du -sk /lib/modules/3.4.48try1 -> 13.7 M


lsmod on computer: harrier

Code:

Module                  Size  Used by
rtl8192cu              70553  0
rtl8192c_common        41821  1 rtl8192cu
rtlwifi                69702  1 rtl8192cu
vfat                    6898  0
fat                    33888  1 vfat
sg                     19182  0
snd_intel8x0           19777  1
arc4                     927  2
zd1211rw               37540  0
mac80211              146798  4 rtl8192cu,rtl8192c_common,rtlwifi,zd1211rw
cfg80211              115174  3 rtlwifi,zd1211rw,mac80211
rfkill                 10206  1 cfg80211
radeon                631418  0
ttm                    37688  1 radeon
drm_kms_helper         17789  1 radeon
drm                   136676  3 radeon,ttm,drm_kms_helper
agpgart                17404  2 ttm,drm
backlight               2745  1 radeon
i2c_algo_bit            3640  1 radeon
ipv6                  181191  10
nfsd                  161480  11
lockd                  41513  1 nfsd
nfs_acl                 1588  1 nfsd
auth_rpcgss            20813  1 nfsd
sunrpc                116690  11 nfsd,lockd,nfs_acl,auth_rpcgss
exportfs                2556  1 nfsd
snd_ac97_codec         76922  1 snd_intel8x0
pcspkr                  1216  0
ac97_bus                 683  1 snd_ac97_codec
snd_pcm                43829  2 snd_intel8x0,snd_ac97_codec
fan                     1679  0
thermal                 6028  0
processor              14633  0
button                  3247  0
tpm_tis                 5819  0
tpm                     8886  1 tpm_tis
tpm_bios                3281  1 tpm
snd_timer              12300  1 snd_pcm
snd                    34278  6 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer
snd_page_alloc          4650  2 snd_intel8x0,snd_pcm
floppy                 39117  0
k8temp                  2304  0
rtc_cmos                6437  0
forcedeth              41016  0
ehci_hcd               30655  0
i2c_nforce2             3949  0
i2c_core               12423  5 radeon,drm_kms_helper,drm,i2c_algo_bit,i2c_nforce2
thermal_sys             9495  3 fan,thermal,processor
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Sun Sep 01, 2013 3:13 am    Post subject: Reply with quote

I was hoping for minimal memory footprint, but with a twist: want to keep it small regardless of what machine I'm running it on.
Kernel:
Code:
-rw-r--r-- 1 root root 2968960 May 31 22:07 kernel64-3.9.2

Worst Modules:
Code:
fglrx                5097152  171
radeon                735920  1
kvm                   368472  1 kvm_intel
ipv6                  264086  55 bridge
sunrpc                175964  45 nfs,nfsd,auth_rpcgss,lockd,nfsv4,nfs_acl
snd_hda_codec         139451  3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
kvm_intel             122383  0
nfsv4                 120263  0
nfs                   116704  1 nfsv4
nfsd                   91905  11
bridge                 82056  0

I can't exactly statically link fglrx unfortunately. I'm not entirely sure why radeon is being used though... I should get rid of that (probably for KMS, not sure if fgrlx needs it?) And I don't necessarily need kvm on all machines (and may run this build of kernel as a VM under the same kernel on this machine :D)
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Sun Sep 01, 2013 5:55 am    Post subject: Reply with quote

wow, I never saw kernels over 3M :)

Here are the kernels I have installed on my Thinkpad laptop

Code:

-rw-r--r-- 1 root root 2324048 Oct  1  2011 kernel-2.6.38-gentoo+tuxonice-r6
-rw-r--r-- 1 root root 2323792 Nov 12  2011 kernel-2.6.39-gentoo+tuxonice-r3
-rw-r--r-- 1 root root 2618992 Mar 15 00:07 kernel-3.2.40-gentoo+tuxonice
-rw-r--r-- 1 root root 2679280 Mar 13 22:29 kernel-3.4.34-gentoo+tuxonice
-rw-r--r-- 1 root root 2701360 Jul 26 00:37 kernel-3.8.13-gentoo+tuxonice
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Sun Sep 01, 2013 6:04 am    Post subject: Reply with quote

32 or 64 bit kernel?

My 64-bit machines (x86_64 and ia64) always had huge kernels... but 32-bit has been increasing...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8933

PostPosted: Sun Sep 01, 2013 7:01 am    Post subject: Reply with quote

/me saw a steady increase in kernel size since 3.6, only partially due to additional needed options:

Code:
4,6M  /boot/kernel-3.11_rc7
6,5M  /lib/modules/3.11.0-rc7+


@dmpogo: 32/64 bit aside, it also heavily depends on your choice of compression. I could use xz and reduce kernel size quite a lot, but would need to wait longer for decompression.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3920
Location: Hamburg

PostPosted: Sun Sep 01, 2013 8:35 am    Post subject: Reply with quote

dmpogo wrote:
wow, I never saw kernels over 3M :)

Here are the kernels I have installed on my Thinkpad laptop
me to (T420), but modules is bigger :
Code:
n22 ~ # ls -lh /boot/*kernel*
-rw-r--r-- 1 root root 1.6M Aug 29 22:16 /boot/initramfs-genkernel-x86-3.10.10
-rw-r--r-- 1 root root 1.6M Aug 31 19:16 /boot/initramfs-genkernel-x86-3.11.0-rc7+
-rw-r--r-- 1 root root 1.7M Aug 29 22:01 /boot/initramfs-genkernel-x86-3.4.60
lrwxrwxrwx 1 root root   32 Aug 31 19:12 /boot/kernel -> kernel-genkernel-x86-3.11.0-rc7+
-rw-r--r-- 1 root root 2.3M Aug 29 22:11 /boot/kernel-genkernel-x86-3.10.10
-rw-r--r-- 1 root root 2.4M Aug 31 19:12 /boot/kernel-genkernel-x86-3.11.0-rc7+
-rw-r--r-- 1 root root 2.2M Aug 29 21:53 /boot/kernel-genkernel-x86-3.4.60
-rw-r--r-- 1 root root 1.4M Aug 29 22:11 /boot/System.map-genkernel-x86-3.10.10
-rw-r--r-- 1 root root 1.5M Aug 31 19:12 /boot/System.map-genkernel-x86-3.11.0-rc7+
-rw-r--r-- 1 root root 1.3M Aug 29 21:53 /boot/System.map-genkernel-x86-3.4.60

n22 ~ # du -ms /lib/modules/*
11      /lib/modules/3.10.10
11      /lib/modules/3.11.0-rc7+
10      /lib/modules/3.4.60
Back to top
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Sun Sep 01, 2013 3:03 pm    Post subject: Reply with quote

jimmij wrote:
i915, atl1c, snd... as a modules, really?
What's the benefit of that besides artificially smaller kernel?

ps. My vanilla 3.10.9 with LZO compression has 4.4M.


My theory was that the kernel should just contain core components needed to boot and repair the system in case of an emergency. I Can do without sound, wireless and graphics in that case.

besides that I actually was having trouble with some of the stuff when it was built in such as wireless.
I guess if I wanted I could build a monolithic kernel. I've done it before but I seem to get better performance this way.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Sun Sep 01, 2013 3:49 pm    Post subject: Reply with quote

genstorm wrote:
/me saw a steady increase in kernel size since 3.6, only partially due to additional needed options:

It's been increasing since Linux was first released... :D

I still remember the kernels that could fit on a 5.25" DD floppy when I first started using Linux...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21490

PostPosted: Sun Sep 01, 2013 4:42 pm    Post subject: Reply with quote

I configure with the rule that if a feature is likely to be loaded all or almost all of the time, then it is built-in. Thus, I include sound and graphics in the core, because both of them are difficult to unload and likely to be loaded as soon as I start using the system.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8933

PostPosted: Sun Sep 01, 2013 5:23 pm    Post subject: Reply with quote

eccerr0r wrote:
genstorm wrote:
/me saw a steady increase in kernel size since 3.6, only partially due to additional needed options:

It's been increasing since Linux was first released... :D

Of course it is - that was more wrt my first comment in this thread ;)
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Sun Sep 01, 2013 7:01 pm    Post subject: Reply with quote

eccerr0r wrote:
32 or 64 bit kernel?

My 64-bit machines (x86_64 and ia64) always had huge kernels... but 32-bit has been increasing...


Mine are 64-bit, x86_64, and with CONFIG_CC_OPTIMIZE_FOR_SIZE=y.
What my kernels do not have is almost any of kernel debugging
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Sun Sep 01, 2013 7:08 pm    Post subject: Reply with quote

genstorm wrote:
/me saw a steady increase in kernel size since 3.6, only partially due to additional needed options:

Code:
4,6M  /boot/kernel-3.11_rc7
6,5M  /lib/modules/3.11.0-rc7+


@dmpogo: 32/64 bit aside, it also heavily depends on your choice of compression. I could use xz and reduce kernel size quite a lot, but would need to wait longer for decompression.


my compression is plain gzip
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum