Skip to content

Feature request: Intel Raptor Lake+ Big Little - E & P-core pinning #7

@Mirabis

Description

@Mirabis

Is your feature request related to a problem? Please describe.
I'm currently pinning certain LXCs to e-cores and others to p-cores depending on their workload. I'd like to start using this script but would love it if I can keep that functionality or even manage it through this script.

For example on my system:

13th Gen Intel(R) Core(TM) i5-13500 has cores 0-11 as P-cores and 12-19 as E-cores. I can thus pin an LXC to X-cores within an lxc conf file with:

[Performance Cores](lxc.cgroup2.cpuset.cpus: 0-11)
[Efficiency Cores](lxc.cgroup2.cpuset.cpus: 12-19)

Describe the solution you'd like
If that behaviour could be mimicked, or my existing tags "e-core" / "p-core" can be kept than another script will modify those files as is currently already done.

Describe alternatives you've considered
I already have a script I run periodically through cron to update the conf files based on PVE tags I have assigned to LXCs.

Additional context
My existing script below:

[root@pve scripts]$ cat tag-based-lxc-cpu-pinning.sh
#!/bin/bash

for conf_file in /etc/pve/lxc/[0-9]*.conf; do
    container_id=$(basename "$conf_file" .conf)
    tags_line=$(grep -oP '(?<=tags: ).*' "$conf_file")

    # Check if tags line exists and contains "p-core" or "e-core" or "core-{number}"
    if [ -n "$tags_line" ]; then

        if echo "$tags_line" | grep -oP "core-\K\d+"; then
          specific_core=$(echo "$tags_line" | grep -oP "core-\K\d+")
          cpus_range=$specific_core
        else
            if echo "$tags_line" | grep -q "p-core"; then
                cpus_range="0-11"
            else
                cpus_range=""
            fi

            if echo "$tags_line" | grep -q "e-core"; then
                if [ -n "$cpus_range" ]; then
                    cpus_range="0-19"
                else
                    cpus_range="12-19"
                fi
            fi
        fi

        # Update or create the lxc.cgroup2.cpuset.cpus value in the container's config file
        if [ -n "$cpus_range" ]; then
            if grep -q "^lxc.cgroup2.cpuset.cpus:" "$conf_file"; then
                sed -i "/^lxc.cgroup2.cpuset.cpus:/s/.*/lxc.cgroup2.cpuset.cpus: $cpus_range/" "$conf_file"
            else
                echo "lxc.cgroup2.cpuset.cpus: $cpus_range" >> "$conf_file"
            fi
            echo "Updated $container_id ($tags_line): lxc.cgroup2.cpuset.cpus=$cpus_range"
        fi
    fi
done

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions