Consider the following:
$ dmesg | grep 'Memory:'
[ 0.000000] Memory: 8009456K/8272776K available (8474K kernel code, 1293K rwdata, 3984K rodata, 1488K init, 1316K bss, 263320K reserved, 0K cma-reserved)
Effectively, this suggests that at boot system has 8009456K available for tasks (minus reserved stuff). However, after boot free
and vmstat
report something very peculiar
$ free -k ; vmstat -s | head -n 1
total used free shared buff/cache available
Mem: 8059880 2774996 2667600 394196 2617284 4529964
Swap: 1048572 412 1048160
8059880 K total memory
Strangely enough, a system that has already booted has more memory available, which seems logically the opposite of what one would expect - at boot time there should be less processes running therefore more total usable memory should be available. How can this be explained ?
free
andvmstat
would be smaller. 1 KB is0.97 KiB. – Sergiy Kolodyazhnyy Nov 25 '17 at 20:54free
andvmstat
pull their information from/proc/meminfo
, which says Total is physical RAM minus reserved stuff (by various hardware). The 2774996K you mention - that's total memory minus cache+buffers+free columns (according to the manual). In other words, I'm more interested in why kernel "sees" more physical ram after boot. Logically, at boot there'd be less hardware would reserve ram, but instead this appears as opposite. – Sergiy Kolodyazhnyy Nov 25 '17 at 21:10