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

get_core_ids() missing cores specfied by isolcpus= on linux boot #2

Open
ajvok opened this issue Aug 16, 2020 · 2 comments
Open

get_core_ids() missing cores specfied by isolcpus= on linux boot #2

ajvok opened this issue Aug 16, 2020 · 2 comments

Comments

@ajvok
Copy link

ajvok commented Aug 16, 2020

I prevent core 3 (I have 4 cores numbered: 0..3) from being used by anything else on the system by adding isolcpus=3 to my kernel command line parameters.
On reboot this is OK. 'top' shows all 4 cores, with core 3 100% idle. This is as hoped for.

Next I want to run my rust program on core 3 only.
core_affinity::get_core_ids() only returns 3 elements, not 4.
The missing element is for core 3 so I can't then
core_affinity::set_for_current().

This makes it impossible to do what I wanted (run my rust app on its own isolated core).

Does this point to an issue with core_affinity::get_core_ids()? I expected it to return 4 elements.

Thanks for your help. Cheers.

@ajvok
Copy link
Author

ajvok commented Aug 16, 2020

A bit more effort and I see that a CoreId is simply a...
pub struct CoreId {
id: usize,
}
So I can achieve want with this:
core_affinity::set_for_current(core_affinity::CoreId{id:3});

Thanks for your crate. It works for me now. Maybe it could be improved by core_affinity::get_core_ids() returning all the cores irrespective of the any isolcpus setting?

@raphaelcohn
Copy link
Contributor

I'm no longer maintaining this crate. A far more comprehensive, Linux aware crate for cores, hyperthreads and NUMA nodes is https://github.com/lemonrock/linux-support .

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