Memory usage of Torizon OS

I’ve just installed my first Verdin iMX8M-Plus QuadLite 1GB RAM + 8GB Flash and I installed Torizon OS Quarterly 6.4.0+build.5 without evaluation container.
The RAM usage of Torizon OS itself is 436M/973M (45% more or less)


It seems a little bit high for a device which has only 1GB of RAM.

Question for Toradex engineers: is this an expected metrics?
Is there space to optimize this usage?

Greetings @vix,

I just checked and although I’m on a 4GB variant I see a similar memory usage of ~420M or so. I went back and checked on 5.7.2 and I see a similar level of memory usage their as well. That at least tells me this has been about the same for a while now. Therefore this doesn’t seem specific for the 6.4.0 release.

I see docker/container related processes take up a decent chunk of this used memory. Stopping these processes helps things a bit though there’s still quite a bit of used memory spread through various processes. Also stopping docker kind of defeats the purpose somewhat.

Let me bring this up internally for discussion.

Best Regards,
Jeremias

The same build 6.4.0+build.5 for a Verdin iMX8M-Mini has an usage or more or less 200 MB.
Last week I met @stefano.tx and @sergio.tx and it seems that the usage is somehow related to a huva amount of memory reserved by Linux,cma
If this is true, it doesn’t match what is listed here in the Toradex KB.

I have done a quick test on Verdin iMX8MP.

One culprit is the kernel CMA feature.

If you run the commands below at the bootloader prompt, the memory consumption is cut by half:

setenv tdxargs cma=0
boot

CMA is configured in the device tree at the BSP level. Changing this might have side effects (e.g. GPU not working properly).

There might be also other possible improvements at the user space level.

Sergio Prado

Thank you @sergio.tx
I’ll wait for a detailed investigation (and a fix, hopefully) from the Torizon OS Dev team

Hi @vix !

FYI, the investigation related to this topic is still ongoing.

We will send an update here once we have some information to share.

Best regards,

1 Like

Hi @vix !

I would like to ask a question for our better regarding this topic.

What impact does the amount of memory available have on your project?

Best regards,

Hi @henrique.tx
what do you mean with your question?
It’s not clear to me.

Hello @vix ,
I think that what @henrique.tx means with his question is if you need a minimum amount of free memory for your project.

Best regards,
Josep

1 Like

Hello @henrique.tx and @josep.tx

my application is a Next.js application, which uses Chromium container to render the UI (which is 1080p resolution).
Based on my preliminary profiling, my application requires more or less 650 MB of RAM.
I would like using a QuadLite S0M (which has 1GB of RAM), and I was advised not to create a swap file on the eMMC (see here) to avoid rapid flash degradation.

Hi @vix!

Thanks for the information.

The investigation is still ongoing.

This kind of configuration can be really project-dependent and there may be no right or wrong answer from Torizon OS point of view.

In the meantime, what you can do is simply try different values for CMA and check the behavior of your system.

You can do so by changing its value on the device tree [overlay] source and/or following @sergio.tx’s tip about the kernel command line argument (reference: The kernel's command-line parameters — The Linux Kernel documentation).

With this tip, you can find a value that allows you to use the 1GB RAM module.

Best regards,

Hi @henrique.tx
I let you know

Hello @henrique.tx
based on my test, it seems that 256MB is the minimum value that allows weston-vivante container running over Torizon OS.
With lower values, weston-vivante crashes.
The other containers that I tested run properly with lower values.
Does weston-vivante require CMA for some reason?
Is it possible that HMP support requires some (unnecessary) big CMA space?

Thanks

Hi @vix

It doesn’t surprise me that weston-vivante needs CMA memory for DMA usage. A quick google search turns up forum posts and such that seem to confirm this. Notably this post from one of the NXP forums.

I don’t have any specific knowledge of the requirements of Weston but it is certainly feasible that there is a minimum amount below which it will fail on an allocation attempt. Do you have any log messages that could confirm that?

Drew

Hello @drew.tx ,
I made some tests with the QuadLite 1GB setting 0 as cma memory
Log file attached when vivante crashes, I remove logs of other containers.
For completeness, sometimes everything starts correctly without crashing.

quadlite_log.txt (108.7 KB)

@vix

Thanks for that log. I’ve attached it to our internal tickets in case we see other such scenarios. The best I can suggest at the moment is to leave that value at the minimum where it does not crash.

Drew