My current conclusions are the following. In the text
> dmesg | grep Memory
Memory: 56468K/64768K available (3897K kernel code, 484K rwdata, 1707K rodata, 152K init, 210K bss, 8300K reserved, 0K cma-reserved)
- it is stated that system has 64768K physical memory. It is becase 64768K + 768K = 65536K, where 768K is used for RTOS.
- it is stated that 56468K of 64768K is available for use.
- So 64768K - 56468K = 8300K is lost somewhere. This value is equal to
reserved
value of dmesg output. By the way it is calculated and printed in page_alloc.c file of kernel code.
It seems that these 8300K reserved
is a sum of the following:
- 6085Kb =
3897K kernel code, 484K rwdata, 1707K rodata, 152K init, 210K bss
- plus 1024Kb of
struct page
memory structures, for 64Mb of RAM (linux kernel - Reserved RAM: Determine the reason for reserved main memory? - Unix & Linux Stack Exchange) - plus 950Kb from
cat /proc/sys/vm/min_free_kbytes
Milk-v’s value (Linux Kernel 'Reserved' Memory - Stack Overflow) - plus SWIOTLB size on some systems, but this is not a case for Milk-v.
- plus cma-reserved size, which is 0 for Milk-v.
So we have explained 8059Kb = 6085Kb for kernel code and it’s data structures (handles, pipes, etc) + 1024Kb of struct page + 950Kb of min_free_bytes. And 241Kb lost for some other reasons that I cannot find.
p.s. I think that reserved
wording for dmesg is incorrect and misleading. The better will be something like total used by kernel
.