Skip to content

Configuring Linux schedulers

Configuring Linux schedulers

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.

    console title="Example CPUWeight" --8<-- "demos/container_qm_scheduling/container_qm_scheduling.aib.yml:19:22"

Verification

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

    console title="Example Automotive Image Builder command" --8<-- "demos/container_qm_scheduling/build.sh:31:39"

  2. Use automotive-image-runner to start your image:

    console title="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:

    console title="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:

    ```console title="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