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

No options to use isolated CPU cores #2539

Open
pkumarg opened this issue Dec 2, 2024 · 3 comments
Open

No options to use isolated CPU cores #2539

pkumarg opened this issue Dec 2, 2024 · 3 comments

Comments

@pkumarg
Copy link

pkumarg commented Dec 2, 2024

Hi,

I'm working on a Linux system with Realtime Kernel, and I have most of the core isolated by tuned. 'isolated' in general if you don't know is that Linux OS cannot use these cores to run anything until you explicitly specify.

Now I have around 32 cores, where system is running only on 2 cores, rest of the cores isolated for Realtime software to run. Now whenever I have to compile this big Realtime software, building takes too much as ninja-build only can run 2 cores. While others are just idle.

Please provide an option so that ninja-build can launch compiler threads on a user provided core list. Below can be examples
ninja --core-list=1-31
ninja --core-list=1,2,3,4-20,25-27

Thanks

@pkumarg pkumarg changed the title No options to use isolate CPU cores No options to use isolated CPU cores Dec 2, 2024
@digit-google
Copy link
Contributor

Try using Linux cgroups instead. For example, if you have systemd on your system: systemd-run --scope --property AllowedCPUS=1-31 ninja ... will do exactly what you're asking for.

@pkumarg
Copy link
Author

pkumarg commented Dec 2, 2024

Hi,

Thanks for quick answer but it looks like with this option also compilation spans only till non isolated cores:
image

In attached image you can see 'P' field, where cores 0,1,32,33 which are non-isolated are picked allocated only when I'm giving this command:
sudo systemd-run --scope --property=AllowedCPUs=0-31 ninja

Seems range 0-31 had no effect. Any ideas what could be happening.

I'll explore too.

Thanks though.

@digit-google
Copy link
Contributor

Looks like cgroups / systemd-run is not working properly on your system. You could try verifying that by starting a scoped shell then looking at the content of /proc/cpuinfo to check that it reflects the range you gave, e.g.:

# Start a shell with a restrict CPU set, using `sudo` to escalate privileges to root
# then switching back to the current user.
sudo systemd-run --scope --property AllowedCPUs=0-7 sudo -u $USER bash -i

# This should only list 0 to 7, included.
grep -e '^processor:' /proc/cpuinfo 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants