Available memory on Colibri iMX8

The Colibri iMX8DX only shows 766MB memory available when running Torizon.
$ cat /proc/meminfo
MemTotal: 784820 kB
Where are the remaining 250-ish MBs?
How can we get them back?

The Colibri iMX7 reports 999MB available in comparison.

Greetings @hordur.

So there’s a number of factors here. Let me go through what I know first.

First of all, meminfo shows total usable RAM but only for user-space. It doesn’t actually reflect the amount of memory that is physically attached to the system. What this means is that the value you see in meminfo is after various deductions to the “real” total memory value. Furthermore meminfo measures memory in kibibytes not kilobytes.

As an example here’s what I see on my board. I only have a 2GB variant of the i.MX8X on hand so it’s not going to be one to one with your case.

# Total memory available in userspace in kibibytes
cat /proc/meminfo | grep MemTotal
MemTotal:        1813160 kB
# Total memory available at Linux kernel start-up time
dmesg | grep Memory
[    0.000000] Memory: 1308712K/1880960K available (16252K kernel code, 1972K rwdata, 7624K rodata, 3968K init, 1173K bss, 80728K reserved, 491520K cma-reserved)

In the Linux kernel start-up time value we see my device has " 1880960K" available. This is after some deductions, the 16252K kernel code and 80728K reserved that we see in the same line. There are of then other unseen deductions that give us the final “1813160” value we see in meminfo.

If we take these into account then my system memory is roughly in the range of 2GB. Or at least it’s close enough to the “real” value to not be too suspicious. Anyways this is all to say that trying to compare memory values in software compared to physical values can be a bit disingenuous.

That being said your MemTotal value does seem a bit lower than I would imagine even with such considerations, especially compared to my 2GB variant. Could you share your dmesg | grep Memory. Perhaps these additional values could help give more context to what we’re seeing on your side.

Best Regards,
Jeremias

Best Regards,
Jeremias

Here is the line from dmesg.

$ dmesg | grep Memory
[    0.000000] Memory: 542516K/832384K available (16252K kernel code, 1972K rwdata, 7624K rodata, 3968K init, 1173K bss, 60492K reserved, 229376K cma-reserved)
colibri-imx8x-06843575:~$ cat /proc/meminfo | grep MemTotal
MemTotal:         784820 kB

784820 kB = 766425.781 KiB/KB

542516K (available) + 60492K (reserved) + 229376K (cma-reserved) = 832384K
But it is more the total size that the kernel sees (832384K) that I’m wondering about. I would expect that to show something closer to 1GB.
Both yours and mine are “missing” the same amount of memory: 211,125MB
102410242-1880960=216192
1024*1024-832384=216192

I also have a iMX8QXP 2GB IT:

colibri-imx8x-06900114:~$ dmesg | grep Memory
[    0.000000] Memory: 1308716K/1880960K available (16252K kernel code, 1970K rwdata, 7628K rodata, 3968K init, 1172K bss, 80724K reserved, 491520K cma-reserved)

which shows the same result as yours.

The iMX7D 1GB:

[    0.000000] Memory: 883596K/1048576K available (8192K kernel code, 909K rwdata, 4232K rodata, 1024K init, 435K bss, 33908K reserved, 131072K cma-reserved, 131072K highmem)

is showing what I would expect to see on the iMX8, 1048576K, or exactly 1GB.

Hmm the discrepancy between i.MX7 and i.MX8X is certainly odd. Also thank you for pointing out that the amount of memory “missing” seems to be the same.

Let me check with our dev team and see if they have an idea where this “missing” memory gets allocated to. However my initial thought is perhaps the SCU that runs on the i.MX8X and i.MX8QM SoCs. This runs and initializes before the kernel and may grab some memory for itself. Though like I said let me check internally first.

Best Regards,
Jeremias

I think I nailed down what exactly occupies the memory we see “missing” here. It seems that the GPU allocates some memory for itself. This gets set in some low-level device tree from NXP.

This would explain the difference we see between i.MX7 and i.MX8QXP since the i.MX7 has no GPU.

You could try disabling the GPU (assuming you don’t need it), and see if that increases the memory available for use.

Best Regards,
Jeremias

Ok, that sounds plausible. We are indeed not using the GPU at this time, so disabling it would be fine.

Can you point me in the right direction on how to disable it?

Thanks,

Probably the most straightforward way would be to disable the relevant nodes in the device tree related to the GPU. Off the top of my head I believe the two most relevant nodes to disable are gpu_3d0 and imx8_gpu_ss. There may be other nodes too, but start with these first and see where that gets you.

Best Regards,
Jeremias