0

Moved from here: https://stackoverflow.com/questions/7070640/how-to-fix-disappeared-memory-after-linux-2-6-18-kernel

I think there is currently a known issue that there are some issues with memory display since 2.6.18 kernel:

For example:

dmesg | grep Memory
[    0.000000] Memory: 82008k/98304k available (3091k kernel code, 448k absent,        15848k     reserved, 2471k data, 460k init)

which is the actual amount of memory on a 96MB RAM VPS using Xen PV.

However, when using free -m, here is the actual output:

free -m
             total       used       free     shared    buffers     cached
Mem:            86         74         11          0          8         48
-/+ buffers/cache:         18         68
Swap:          127          0        127

It seems that 10MB of memory was "eaten" away by the free -m output.

Does anyone have any solution to fix this?

Thanks!

zhuanyi
  • 191
  • 3
  • 11

1 Answers1

1

With only 90MB to start with you are noticing the amount of memory used by the kernel for both kernel tables and compiled in drivers taking a significant percentage of your memory. That issue is pretty easily fixed through tuning.

If you are looking to reduce the amount of memory pegged for the kernel you should probably investigate building your own kernel. It isn't clear from the question what OS you are using but if you are on CentOS or some other consumer linux the kernel probably has a bunch of stuff compiled in that you probably aren't using. Here are some resources for building a slimmer kernel:

http://elinux.org/Kernel_Size_Tuning_Guide

http://www.yolinux.com/TUTORIALS/LinuxTutorialOptimization.html

polynomial
  • 4,016
  • 14
  • 24
  • So essentially there is no easy way unless I compile my own kernel? I am wondering why is free -m not showing things properly though... – zhuanyi Aug 16 '11 at 22:51
  • @zhuanyi as the memory you are "missing" is in use by the kernel, you could not use it from user space and it will never be freed. So it is not shown to you. More here: http://linux-mm.org/WhereDidMyMemoryGo – Thomas Berger Aug 17 '11 at 18:52
  • So essentially we are still running with less memory then? That really sucks... – zhuanyi Aug 22 '11 at 22:43
  • I think what you've run into is the basic reason that things like QNX, Minix, VXWorks and others exist. The generic linux kernel is considered huge by embedded or minimal system resource standpoints. You may be able to find someone else maintaining a version of the linux kernel aimed at smaller memory usage if you really don't want to compile one yourself. – polynomial Aug 22 '11 at 22:51
  • @polynomial: thanks for the quick response, to be honest I am just a little afraid that I will not be able to compile things properly if I compile the kernel myself, compiling kernels (and optimizing them) really sounds like a job that only "pros" would do :) – zhuanyi Aug 22 '11 at 22:54
  • You should check out some of the distros here then: http://wiki.laptop.org/go/Minimal_Linux_distros It would probably be easier than maintaining your own. – polynomial Aug 22 '11 at 22:56