Re: i386: CONFIG_HIGHMEM4G only detects 3 GB out of 4 GB of memory

From: Andy Lutomirski
Date: Sat Oct 10 2020 - 19:00:59 EST




> On Oct 10, 2020, at 2:50 PM, Paul Menzel <pmenzel@xxxxxxxxxxxxx> wrote:
>
> Dear Linux folks,
>
>
> On an Asus F2A85-M PRO with two 2 GB RAM modules installed, and an APU device, building Linux with `ARCH=i386` and `CONFIG_HIGHMEM4G=y` only 3 GB seem to be detected: 2.2 GB according to `free -h` plus the 768 MB for APU graphics memory).
>
>> [ 0.065059] Memory: 2285148K/2324512K available (11785K kernel code, 892K rwdata, 2748K rodata, 668K init, 544K bss, 39364K reserved, 0K cma-reserved, 1423796K highmem)
>
>> [ 0.402082] calling populate_rootfs+0x0/0xa1 @ 1
>
>
>> $ free -h
>> total used free shared buff/cache available
>> Mem: 2,2Gi 72Mi 2,0Gi 13Mi 130Mi 2,0Gi
>> Swap: 0B 0B 0B
>
> With `CONFIG_HIGHMEM64G=y` the whole 4 GB are used (3.1 GB + 768 MB for APU graphics memory).
>
>> [ 0.121036] Memory: 3229952K/3356700K available (10301K kernel code, 821K rwdata, 2700K rodata, 708K init, 540K bss, 126748K reserved, 0K cma-reserved, 2449840K highmem)
>
>> [ 0.450668] calling populate_rootfs+0x0/0xa1 @ 1
>
> The Kconfig help text for `HIGHMEM4G` says:
>
>> Select this if you have a 32-bit processor and between 1 and 4 │ gigabytes of physical RAM.
>
> As I only have 4 GB, I chose that to save 50 ms (maybe only due to less memory detected), and thought non-PAE kernels can use 4 GB of memory.
>

Your memory map contains:

BIOS-e820: [mem 0x0000000100001000-0x000000013effffff] usable

That’s 0x3effffff bytes mapped at a physical address above 4G.

The 4G limit without PAE isn’t, strictly speaking, about how much RAM can be used; it’s about the maximum usable physical address. One might wonder why your firmware set up your memory map like this.

But there’s a much bigger issue: why on Earth are you running a 32-bit kernel on a relatively new machine like this?