LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-19-2017, 07:37 PM   #1
patrick295767
Member
 
Registered: Feb 2006
Distribution: FreeBSD, Linux, Slackware, LFS, Gparted
Posts: 664

Rep: Reputation: 138Reputation: 138
How much memory uses your kernel?


Hello,

Compiling kernel is highly recommended and usually the best way to go.

How much memory uses your kernel?

Best regards
Pat
 
Old 01-19-2017, 07:45 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,647
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
... ... ...
 
Old 01-19-2017, 08:11 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
Do you mean, "how much memory does your kernel use?"

I just looked in top, and that's really hard to say, as top shows what programs and processes use how much memory, and it certainly depends on what programs you are running. For what it's worth, here's the gross output of top on my system, using the generic kernel that comes with Slackware:

Code:
top - 21:06:00 up 26 days,  4:53,  2 users,  load average: 0.19, 0.25, 0.18
Tasks: 240 total,   1 running, 239 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.0 us,  1.0 sy,  0.0 ni, 96.7 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 16262452 total,  1371744 free,  8614920 used,  6275788 buff/cache
KiB Swap:  4883756 total,  4801576 free,    82180 used.  6451124 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                               
13668 [username]  20   0 7378636 5.055g 4.994g S   8.3 32.6   1:24.36 VirtualBox                                                            
 1829 [username] ankbe+  20   0   80412  26260  13660 S   6.3  0.2  53:24.17 x11vnc                                                                
 1802 root      20   0  719284 416620  94576 S   3.3  2.6 241:09.71 Xorg                                                                  
 1827 [username]  20   0   38576   3916   3532 S   1.3  0.0 557:06.76 swisswatch                                                            
 8501 [username]  20   0  587464  45748  23384 S   1.3  0.3   0:11.34 terminator                                                            
 1826 [username]  20   0  403444  27200  18468 S   0.7  0.2 204:14.36 gkrellm                                                               
13623 [username]  20   0  722396  20396  15460 S   0.3  0.1   0:01.89 VBoxSVC                                                               
14404 [username]  20   0   22684   3052   2556 R   0.3  0.0   0:00.29 top                                                                   
26264 [username]  20   0 3959252 804464 163492 S   0.3  4.9  32:25.82 vivaldi-bin                                                           
    1 root      20   0    4360   1284   1232 S   0.0  0.0   0:12.15 init                                                                  
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.42 kthreadd                                                              
    3 root      20   0       0      0      0 S   0.0  0.0   0:04.70 ksoftirqd/0                                                           
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
 
Old 01-19-2017, 08:47 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Linux will use all of memory NOT dedicated to a peripheral (such as video RAM).

Most of it gets used for various buffer caches.

When applications get started the buffer caches will get trimmed, and the released memory is allocated to the application process(es).

So what do you mean by "how much memory uses your kernel"?
 
Old 01-21-2017, 04:32 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by patrick295767 View Post
Compiling kernel is highly recommended and usually the best way to go.
recommended "highly" by who (except you, obviously)?
and why is it the best way to go? for everyone? or what do you mean by "usually"?
 
Old 01-21-2017, 06:54 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by ondoho View Post
recommended "highly" by who (except you, obviously)?
and why is it the best way to go? for everyone? or what do you mean by "usually"?
Anyone that wants to reduce the size of the kernel by eliminating unused features. This is what is done for embedded use.

Now for a general use - it won't reduce the kernel that much (general use usually needs a number of those features). It doesn't reduce it much because MOST features (not all) are loadable at run time, so they don't consume memory unless used. But having the support for loadable kernel modules does make the kernel larger, it also makes each feature slightly larger. This makes a running kernel larger than one with the specific features compiled in. This also can make boot slightly faster as most of the work of the initrd (identifying devices, loading drivers/filesystems, loading filesystems) has already been done - and you can bypass the use of initrd by going directly to the root device when kernel initialization is done (this is instead of going to the intrd then to the root device). It can also make using USB connections a bit more difficult (only certain USB devices may work). Bypassing the initrd can improve boot time by 5-10 seconds depending on the configuration.

The result a kernel with all features compiled in (and without loadable modules) makes it more difficult to move from system to system. It can be done if the next system contains exactly the same hardware - but sometimes replacing a device controller will cause the boot to fail (different driver).

Last edited by jpollard; 01-21-2017 at 06:55 AM.
 
Old 01-21-2017, 07:10 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,567
Blog Entries: 19

Rep: Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447
There was an earlier thread on whether it's better to compile your own kernel (in a distro that doesn't require you to) and the consensus seemed to be that, in a tightly integrated system like Debian or Fedora, you're better off using the kernel that the developers assume to be present on your system. Systems that make you "roll your own" (Crux, LFS, Gentoo) are also much more loosely coupled as regards overall software.

Personally I like a homemade kernel because it avoids having to use an initrd (I really hate those), but on Debian I use the kernel provided.

One case where I had to build my own was when I installed NuTyX on my laptop. It has Vaio Chrome graphics, which proved incompatible with the framebuffer console that the initrd insisted on creating.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel - Memory Management - Copy Virtual Memory Area shankur90 Programming 1 06-07-2016 11:07 PM
Creating memory chunk in kernel memory libee Linux - Newbie 0 03-28-2012 05:03 AM
SHM Memory Counted as Cache Memory with Kernel 2.6.18? kresyzig Programming 4 08-25-2010 11:06 PM
kernel: how do pci-memory a conventional memory? vv40in Linux - Newbie 0 06-05-2008 02:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:25 AM.

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