Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mirabis opened this issue Sep 30, 2024 · 1 comment
Open
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Mirabis
Copy link

Mirabis commented Sep 30, 2024

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
@fabriziosalmi
Copy link
Owner

I was thinking about cpu pinning and cpu units allocation management since the beginning. This will be so hard to me to implement quickly unfortunately... but of course, if you want to give a try, you more than welcome.
Of course if I wake up a morning with time and faith, I am sure this will be achieved but again.. not in a close future :(

@fabriziosalmi fabriziosalmi added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants