Hi,
we want to make some tests if we can reduce memory on our board.
is there an OS flag to limit Balena memory available? (we have 2GB and we want to see how the system performs with 1GB)
Daniel.
Hi,
we want to make some tests if we can reduce memory on our board.
is there an OS flag to limit Balena memory available? (we have 2GB and we want to see how the system performs with 1GB)
Daniel.
Hi, can you tell us what type of board you have?
Variscite DART imx8m mini
Hey, we did a little investigation here, and it seems that it is possible for you to pass the mem=
kernel command line parameter:
mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory
Amount of memory to be used when the kernel is not able
to see the whole system memory or for test.
[X86] Work as limiting max address. Use together
with memmap= to avoid physical address space collisions.
Without memmap= PCI devices could be placed at addresses
belonging to unused RAM.
I would first try this by interrupting the uboot setup with a keyboard and manually apply it, but you should also be able to do it at runtime with u-boot-fw-utils
and the bootenv
environment variable. Let me know if you’d like some further details here.
just to make sure i understood:
mem=1G will limit my memory to 1G?
Hey Daniel,
The mem=1G
option means that the amount of memory allocated for the kernel will be just 1gb, while the rest will be available for userland.
so it kind of misses what i need or i missed something.
i need the total available amount for both kernel and user to be 1gb (we want to order the same device just with less memory).
this wont simulate the case, correct?
Daniel.
Sorry, there was a little bit of confusion. The mem=
will limit the total amount of memory to be used. That is, set the highest address usable by any process including the kernel. This should cover what you want.
thanks, i’ve stopped the device on boot and set mem=1G.
Mem: 1073912K used, 970112K free, 22480K shrd, 17036K buff, 259972K cached.
i’m probably doing something wrong?
i rebooted after
What makes you think that that is wrong? That seems close enough to 1G to be within an acceptable margin of error. If you wanted less, you could use 990M or something similar.
How did you set the mem cmdline parameter? What did you modify exactly in the u-boot shell?
is mem is an environment var?
i just set mem=1G in the uboot terminal
You should add it to the kernel cmdline. That is typically set using the bootargs
variable in the u-boot shell. So you would do the following:
env edit bootargs
Then add the mem parameter and press Enter. Then do a run bootcmd
and when you get to userspace test the available memory again.
thanks, will try and update