On Mon, Jun 20, 2011 at 10:33:32AM +0000, Andy Smith wrote:
We had a support ticket earlier where a customer with
480MiB RAM is
only seeing 464MiB of it as reported by "free -m".
What does the kernel say? Because AFAIK it is normal for free to report
less, since it does not take into account memory reserved (not cached)
by the kernel.
For example, in my VPS I see:
$ free -m
total used free shared buffers cached
Mem: 463 446 16 0 82 185
$ free
total used free shared buffers cached
Mem: 474404 396212 78192 0 85408 217324
However, you can also look at:
# This only works in 32 bits AFAIK
$ grep LOWMEM /var/log/dmesg
[ 0.000000] 480MB LOWMEM available.
# This should work in both 32 and 64 bits x86
$ grep Memory /var/log/dmesg
[ 0.000000] Memory: 464964k/491520k available (5110k kernel code, 26112k reserved,
2437k data, 708k init, 0k highmem)
491520 / 1024 = 480.
Now, the amount reported by free is taken from:
$ grep MemTotal /proc/meminfo
MemTotal: 474404 kB
which is slightly more than the available part mentioned by the kernel
above. That is because after making the initial reservations, the kernel
frees some of that:
$ grep freed /var/log/dmesg
[ 0.064167] Freeing SMP alternatives: 24k freed
[ 0.212555] Freeing initrd memory: 8708k freed
[ 0.468328] Freeing unused kernel memory: 708k freed
And if we add what it freed to what the kernel reported initially as
available:
464964 + 24 + 8708 + 708 = 474404
we get to the number used by free.
I actually find it strange that it showed you the full amount of RAM.
If you don't mind me asking, in those cases, what do the numbers above
show?
Thanks,
Alberto