Configuring memory allocation
Configuring memory allocation¶
To configure memory allocation, you must tune the memory_limit attributes of high and max for the
QM partition.
The max value represents the maximum limit for memory use in the QM partition. If QM processes attempt to exceed the max limit, the
Out of Memory (OOM) killer is initiated. The high value is the
memory threshold that the kernel tries not to exceed. If QM processes reach the high limit, the kernel will proactively release memory.
Prerequisites
- A custom manifest file with a QM partition, such as the manifest file that you created in Embedding containerized applications in the QM partition.
Procedure
-
In your manifest file, configure the
memory_limitattributesmaxandhighto40%and35%, respectively:console title="Example memory_limit configuration" --8<-- "demos/container_qm_network/container_qm_network.aib.yml:27:30"
Verification
-
Build the image:
console title="Example Automotive Image Builder command" $ automotive-image-builder build \ --distro autosd9 \ --target qemu \ --mode image \ --export qcow2 \ <my_manifest>.aib.yml \ <my_image>.qcow2 -
Run the image:
console title="Example Automotive Image Runner command" $ automotive-image-runner <my_image>.qcow2 -
After the image starts, log in as
rootusing the passwordpassword. -
Use the
systemctl showcommand to display theMemoryMaxvalue generated by themaxoption you set in your manifest:console title="Verify QM partition MemoryMax" [root@localhost ~]# systemctl show qm | grep MemoryMax MemoryMax=823468032 -
Use the
systemctl showcommand to display theMemoryHighvalue generated by thehighoption you set in your manifest:console title="Verify QM partition MemoryHigh" [root@localhost ~]# systemctl show qm | grep MemoryHigh MemoryHigh=720535552 -
Review the contents of the drop-in file generated by your manifest using the
catcommand:```console title="Show drop-in configuration file contents" [root@localhost ~]# cat /usr/share/containers/systemd/qm.container.d/10-automotive.conf [Service] MemoryMax=40% MemoryHigh=35% CPUWeight=idle
[Container]
```
Additional resources