Skip to content

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

Procedure

  • In your manifest file, configure the memory_limit attributes max and high to 40% and 35%, respectively:

    Example memory_limit configuration
    qm:
      memory_limit:
        max: 40%
        high: 35%
    

Verification

  1. Build the image:

    Important

    This documentation is in the process of being adjusted for the changes implemented in Automotive Image Builder 1.1.4. In the meantime, to keep the sample commands in this documentation valid, you must use the deprecated CLI, as shown in this example.

    Example Automotive Image Builder command
    $ aib-dev build-deprecated \
        --distro autosd9 \
        --target qemu \
        --mode image \
        --export qcow2 \
        <my_manifest>.aib.yml \
        <my_image>.qcow2
    
  2. Run the image:

    Example Automotive Image Runner command
    $ automotive-image-runner <my_image>.qcow2
    
  3. After the image starts, log in as root using the password password.

  4. Use the systemctl show command to display the MemoryMax value generated by the max option you set in your manifest:

    Verify QM partition MemoryMax
    [root@localhost ~]# systemctl show qm | grep MemoryMax
    MemoryMax=823468032
    
  5. Use the systemctl show command to display the MemoryHigh value generated by the high option you set in your manifest:

    Verify QM partition MemoryHigh
    [root@localhost ~]# systemctl show qm | grep MemoryHigh
    MemoryHigh=720535552
    
  6. Review the contents of the drop-in file generated by your manifest using the cat command:

    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


© Red Hat