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

How to count Linux CPU cores with large CPU masks? #42

Open
kubo39 opened this issue May 27, 2017 · 1 comment
Open

How to count Linux CPU cores with large CPU masks? #42

kubo39 opened this issue May 27, 2017 · 1 comment

Comments

@kubo39
Copy link
Contributor

kubo39 commented May 27, 2017

Unfortunately, cpu_set_t is not enough for very large CPU maks.

Case study

  • golang
  • allocate 8kB buffer on stack. (8k is the maximum number of cpus supported by Linux 3.17)
  • Ruby
  • allocate buffer on heap step by step(64 -> 128 -> ... -> 16384), return when the counted cores >= 1.
@seanmonstar
Copy link
Owner

O_O

A stack buffer sounds better, though I'd worry that doing so would slow down the common case (how common is it to have more than 64 cpus?). It could perhaps be a #[cold] function that is used if the cpu_set_t wasn't big enough.

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