EEVblog Electronics Community Forum
Products => Computers => Topic started by: DiTBho on July 29, 2021, 01:36:14 pm
-
I am working with Kernel 5.4, profiled for a low memory system with only 32MB soldered ram and I managed to turn off all the features that it doesn't need.
However, when the kernel boots ... it reserves 8Mbyte of ram, and it's not clear for what
Memory: 32768K physical <--------------- 32MB
Memory: 24628K free <------------------ only 24Mbyte available
Memory: 5913K kernel code
Memory: 193K rwdata
Memory: 1312K rodata
Memory: 184K init
Memory: 184K bss
Memory: 8140K reserved <---------------- reserved to what?!?
Memory: 0K cma-reserved
There is no framebuffer. What is this reserved memory? How can it be reduced? :-//
-
Is this related to /proc/sys/vm/min_free_kbytes?
https://linuxhint.com/vm_min_free_kbytes_sysctl/
-
Most likely by the firmware.
[ 0.000000] x86/fpu: x87 FPU will use FXSAVE
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000e6000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000dfe8ffff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000dfe90000-0x00000000dfe9dfff] ACPI data
[ 0.000000] BIOS-e820: [mem 0x00000000dfe9e000-0x00000000dfedffff] ACPI NVS
[ 0.000000] BIOS-e820: [mem 0x00000000dfee0000-0x00000000dfefffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fff00000-0x00000000ffffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x0000000217ffffff] usable
[ 0.000000] NX (Execute Disable) protection: active
-
Is this related to /proc/sys/vm/min_free_kbytes?
#cat /proc/sys/vm/min_free_kbytes
627
it doesn't seem so :-//
-
You'd probably have to configure (and compile yourself) the kernel to modify the amount of reserved memory. Apart from possible use by a GPU (which isn't your case here), it can also just be reserved memory for other device drivers.
You could have a look there: https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
I'm not familiar enough with this to help more than that though. But I would expect 8 MBytes to be a reasonable amout of reserved memory for a desktop computer these days, but certainly not for a small system with just 32 MBytes of RAM. So yeah, you may have to dig a little to figure out how to configure this.
-
it's not clear for what
Memory: 5913K kernel code
Memory: 193K rwdata
Memory: 1312K rodata
Memory: 184K init
Memory: 184K bss
This accounts for the majority. Where do you expect the kernel to go, exactly?
-
You'd probably have to configure (and compile yourself) the kernel to modify the amount of reserved memory
I am already configuring and compiling the kernel by myself.
There is no GPU, no framebuffer.
-
it's not clear for what
Memory: 5913K kernel code
Memory: 193K rwdata
Memory: 1312K rodata
Memory: 184K init
Memory: 184K bss
This accounts for the majority. Where do you expect the kernel to go, exactly?
In that snapshot, it reserves 8Mbyte while the binary size of kernel is 6Mbyte.
+2Mbyte of available ram would be precious to contain second running services, and since I can't modify the hardware, I am doing a lot of things to free more ram.
For instance I hacked the kernel and removed a lot of lines of dead/unused code, and recompiled everything with -Os. I also removed the FPU emulation, saving more Kbyte.
I need static kernel, I cannot use loadable modules (there is a reason, long story), anyway the new kernel is about 3.9Mbyte of ram instead of the 9.5Mbyte of the fist attempt.
3.9Mbyte is << power of 2, but still I have 8Mbyte of reserved ram, and it's not clear for what :-//
-
That is the memory reserved for kernel use. I.E. Code, data, bss, page tables, etc.