Skip to content

Configuring scheduler priority for the QM partition using Automotive Image Builder

To configure scheduler priority to minimize latency and interference, you must tune the CPUWeight for the QM partition to a value between 1 and 100.

CPUWeight is an attribute you can set for hierarchical Linux kernel systemd control groups (cgroups). It splits the available CPU time among all units within one slice relative to their CPU time weight. A higher weight means more CPU time, a lower weight means less.

Automotive Image Builder sets default central processing unit (CPU) scheduler priority for the QM partition to CPUWeight=idle. That means processes in the QM partition do not run until critical processes running on the root partition are idle. If you use the default scheduler priority, it might starve processes in the QM partition of CPU time, so it is important that you find the optimal setting for your needs.

Prerequisites

Procedure

  • In your manifest file, set the cpu_weight for the entire QM partition to a value between 1 and 100. For example, if you were to set CPUWeight=50, all processes in your QM partition would receive half the CPU time that is available to the critical processes running on your root partition.

    Example CPUWeight
      # Override the default SCHED_IDLE scheduler policy
      # to allocate CPU time to the entire QM partition
      cpu_weight: 50
    

Verification

  1. Use Automotive Image Builder to build your image from the manifest:

    Example Automotive Image Builder command
       automotive-image-builder --verbose \
        build \
        --distro autosd9 \
        --target qemu \
        --mode image \
        --build-dir=_build \
        --export image \
        container_qm_scheduling.aib.yml \
        container_qm_scheduling.$arch.img
    
  2. Use automotive-image-runner to start your image:

    Start the image
    automotive-image-runner <my_image>.img
    
  3. After the image starts, log in as root using the password password.

  4. Use the systemctl show command to display the default CPUWeight and the path for the drop-in configuration file generated by the cpu_weight value you set in your manifest:

    Verify QM partition CPUWeight
    [root@localhost ~]# systemctl show qm | grep CPUWeight
    CPUWeight=<value>=1_and_<=100>
    StartupCPUWeigh=[not set]
    
  5. 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=infinity
    MemoryHigh=infinity
    CPUWeight=50
    
    [Container]
    

Additional resources


© Red Hat