LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 08-20-2004, 12:57 AM   #1
Qten
LQ Newbie
 
Registered: Jan 2004
Location: Australia, Qld
Distribution: Redhat 9
Posts: 6

Rep: Reputation: 0
Show Kernel Memory usage?


Hi guys,

Anyone know how to show the amount of memory my kernel is using?

I'm using Fedora Core 2.

Thanks,
Quenten
 
Old 08-20-2004, 01:14 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,159

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
cat /proc/slabinfo should give you some idea of the caches being used by some areas of the kernel and /proc/meminfo will give you some more in depth stats on system memory usage. You could also sum the memory usage of all the processes reported by ps and subtract it from the total amount of memory as reported by top.
 
Old 08-20-2004, 01:15 AM   #3
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 47
2 ways to find out,,,,open a term window and type:
top
OR
free

both of these will give memory usage.........
 
Old 08-20-2004, 01:21 AM   #4
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
There is also 'slabtop' command
 
Old 08-20-2004, 01:38 AM   #5
Qten
LQ Newbie
 
Registered: Jan 2004
Location: Australia, Qld
Distribution: Redhat 9
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for your swift replies...


BUT............. i'm still unsure as to view exactly how much memory my kernel is using. I have 512meg of ram
which of 240 odd is used once i've logged into kde etc.

but i wish to know how much of the 240 is used by my kernel.

As to determen if i'm going to recompile my kernel and how much memory i might gain by doing so.

Cyas,
Quenten
 
Old 08-20-2004, 01:52 AM   #6
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
just so you know kernel is using barely any memory as compared to the overall system. For example, when my system boots and after ALL the startup processes are loaded the overall memory usage is just about 100 MB, and that's with apache, mysql, etc running. (its a server so no X). What kills the performance is the amount of stuff compiled into it. Think of the kernel as a complex filter. if you have 10 layers (small kernel) anything that is sent to the kernel will have to pass through average of 5 layers to get to where its going, if you have 100 layers (large kernel) the average will be 50 layers, and that's where performance drop occurs and not in the amount of memory used, which is negligible in either case. That is why the smaller the kernel, the better performance is. Turn off anything you won't ever need and modularize as much as you can.

Hope this helps.

Small note: A large kernel is about 10 MB in size. My smallest one was/is about 850 KB (with everything working perfectly; that's 2.4.26). My average now is about 1.2 MB with LVS, routing and IPtables (on 2.6.8), plus i compile few things in that can be inserted as modules (i'm lazy ) so that bumps the size a bit.

Last edited by Mikhail_16; 08-20-2004 at 01:57 AM.
 
Old 08-20-2004, 02:02 AM   #7
Qten
LQ Newbie
 
Registered: Jan 2004
Location: Australia, Qld
Distribution: Redhat 9
Posts: 6

Original Poster
Rep: Reputation: 0
Certainly does.

So then by your logic, the less modules and drivers/items which are compiled into my kernel the "Faster" my system will run????

Even if some options are added as modules does this make an effect on the "speed" of the kernel?

Say for example 10 different network card modules are setup in the kernel and i'm only use one of these.
The other 9 should be removed because it will increase the "Speed" of which my system is able to process requests which are put to the kernel as i understand it everything goes though the kernel similar to Windows NT etc?

Quenten
 
Old 08-20-2004, 03:00 AM   #8
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
Your logic is absolutely correct there.

you modularize, so that you can load and unload the modules when and if needed.
modules are not actually compiled into the kernel, but need to be actually loaded (inserted) to be of any effect. that's why you can have as many modules as you want with absolutely no loss of performance as long as they are not loaded into the kernel. and that is why its better to compile things as modules rather then 'build them in'. see the logic?

Plus there are quite a few things that cannot be modularized and are also not needed. for example you don't need to compile anything that relates to scsi if you don't have a scsi card in your box, or there is no need for reiserfs support if you are not going with that filesystem; the list goes on.

Last edited by Mikhail_16; 08-20-2004 at 03:07 AM.
 
Old 08-20-2004, 03:05 AM   #9
Qten
LQ Newbie
 
Registered: Jan 2004
Location: Australia, Qld
Distribution: Redhat 9
Posts: 6

Original Poster
Rep: Reputation: 0
sure do,

I'll give a new kernel a go and thanks for your help thus far..

Quenten,
 
Old 08-20-2004, 03:08 AM   #10
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
(i edited the post above to be a bit clearer)

Small addendum: just so you know, there are things that can be modularized, but should not be, like filesystem support. Also always read help on anything that has it in the kernel. Also check that you include nessessary modules to be loaded on boot, you'll need things like sound, network card(s), usb support, etc. I believe kudzu for redhat/fedora and hotplug for gentoo do that automatically, but i'm not sure about the rest.

Last edited by Mikhail_16; 08-20-2004 at 03:13 AM.
 
Old 08-20-2004, 03:29 AM   #11
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
I have ext3, vfat, udf, nfs in the kernel as I use them, but smb and reiser as a module as they are used rarely if at all.

BTW, curious Mikhail_16, when you talk about kernel size are you talking about vmlinuz size or bzImage size or whatever?
 
Old 08-20-2004, 03:37 AM   #12
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
This is server at work that provides DHCP and nagios monitoring for the work network. Nothing was modified, or removed. (old and failsafe are just in case i screw up main)

genen@corwin ~ $ ls -l /boot/
total 2956
-rw-r--r-- 1 root root 490874 Apr 28 17:43 System.map
lrwxrwxrwx 1 root root 1 Apr 28 19:28 boot -> .
-rw-r--r-- 1 root root 512 Apr 28 17:46 boot.0301
-rw-r--r-- 1 root root 834551 Apr 28 18:49 failsafe
drwx------ 2 root root 12288 Apr 28 13:25 lost+found
-rw-r--r-- 1 root root 834551 Apr 28 17:43 vmlinuz
-rw-r--r-- 1 root root 834551 Apr 28 17:46 vmlinuz.old
genen@corwin ~ $

I'm talking about the final bootable image that goes into bootloader. in my case its vmlinuz. But then i use lilo and execute make bzlilo at the end of make modules_install

Last edited by Mikhail_16; 08-20-2004 at 03:47 AM.
 
Old 08-20-2004, 03:53 AM   #13
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
cool. I'm using 2.6.8.1 and had it trimmed down, but then couldn't get the dvd/cd burner to work, so redid the config several time before I found out it was a kernel 'feature'. So i have a partially trimmed kernel, but it's still 5 meg. Not sure how much smaller I can get it on this box as it already just seems to have the stuff I need, except for a couple of chipset drivers I forgot to remove from the default this time.
 
Old 08-20-2004, 04:12 AM   #14
Mikhail_16
Member
 
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
Well here's mine 2.6.8.1 for comparison:

oberon ~ # ls -l /boot/
total 4942
-rw-r--r-- 1 root root 784055 Aug 18 12:00 System.map
-rw-r--r-- 1 root root 802555 Aug 18 08:53 System.old
lrwxrwxrwx 1 root root 1 Aug 18 09:55 boot -> .
-rw-r--r-- 1 root root 512 Aug 18 08:08 boot.0300
drwx------ 2 root root 12288 Aug 18 08:56 lost+found
-rw-r--r-- 1 root root 1170319 Aug 18 08:07 stable
-rw-r--r-- 1 root root 1091429 Aug 18 12:00 vmlinuz
-rw-r--r-- 1 root root 1170326 Aug 18 08:53 vmlinuz.old
oberon ~ # lsmod
Module Size Used by
e1000 81668 0
3c59x 37160 0
intel_agp 22048 1
agpgart 33320 1 intel_agp
evdev 9728 0
rtc 12600 0
tun 9216 0
bridge 48408 0


This is a box that will serve as a router/openvpn gateway/firewall for a network. so you still have aways to go with your kernel configuration. Plus lsmod withough iptables running (just to show the modules loaded).
 
Old 08-20-2004, 07:08 AM   #15
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
Yeah, hold on I'm all confused as usual and comparing vmlinux to vmlinuz to bzImage and all the rest... IF I make bzImage I get a 1.6 meg kernel and that as small as it gets for me. Just went through and pulled out the couple of bits I didn't need.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to show the memory usage per process ty263 Linux - General 3 09-12-2008 07:36 AM
Linux kernel memory usage.. drminix Linux - Software 1 08-14-2005 06:47 PM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 09:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 05:45 AM
Memory Usage In Enterprise Kernel fishlet Linux - General 2 02-28-2004 06:52 PM


All times are GMT -5. The time now is 04:15 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration