Memory allocation in the QM partition
Memory allocation in the QM partition¶
Memory management is crucial to the smooth performance, stability, and protection of an operating system. Efficient allocation of memory supports process isolation and the ability of an operating system to run multiple processes at once. Memory allocation prevents system crashes and performance slowdowns.
The memory_limit
attributes max and high control how much memory is allocated to the QM partition.
-
maxcontrols the absolute limit for memory use in the QM partition. You can set themaxattribute in bytes or as a percentage value. The default value ofmaxisinfinity, which permits the system to consume as much memory as the system will allow. -
highcontrols the throttling limit for memory use in the QM partition. The value ofhighcan also be set in bytes or as a percentage value. The default value ofhighisinfinity, which essentially eliminates process throttling in times of high memory use.
You can configure memory_limit values in the qm stage of your Automotive Image Builder manifest file to control memory allocation.
console title="Example memory allocation values"
qm:
memory_limit:
max: 50%
high: 45%
Out of Memory killer¶
The Linux kernel memory management system includes the Out of Memory (OOM) killer. The OOM killer terminates processes to release memory when memory becomes critically low. This mechanism ensures that critical processes in the root partition have enough memory to continue to run.
The oom_score_adj parameter influences the likelihood that a process will be terminated by the OOM killer. When an operating system experiences
memory constraints, the OOM killer uses the processes' oom_score_adj values to prioritize which processes to terminate.
The value of oom_score_adj can range from 1000 to -1000. The OOM killer terminates processes with the highest oom_score_adj
values first. If a process is set to -1000, the OOM killer cannot terminate it, whereas the OOM killer would terminate a process set to
1000 first.
When Podman starts a container nested in the QM partition, it writes the default value of 750 into /proc/$PID/oom_score_adj. For more
information about oom_score_adj, refer to man 5 proc_pid_oom_score_adj.