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

Threadpool - CPU topology detection #326

Open
1 of 4 tasks
mratsim opened this issue Dec 26, 2023 · 0 comments
Open
1 of 4 tasks

Threadpool - CPU topology detection #326

mratsim opened this issue Dec 26, 2023 · 0 comments
Labels
enhancement :shipit: New feature or request

Comments

@mratsim
Copy link
Owner

mratsim commented Dec 26, 2023

Followup on #293

  • Outline topology detection goals:
    • get_num_threads_logical: with no OS/C stdlib dependency on x86 (all other arch need privileges to access specific registers)
    • get_num_threads_physical: with no OS/C stdlib dependency on x86 (all other arch need privileges to access specific registers)
    • get_num_threads_os: takes into account disabled cores (Virtual machines)
    • get_num_threads_process: Takes into account cgroup, schedaffinity and taskset.

Goals:

  • Allow counting physical and/or logical cores without syscalls/IO on Linux x86 (no /proc or /sys read) for hardened trusted enclaves like SGX and full no C stdlib support.
  • Allow counting available cores on Linux when running constrained by cgroups, CPUSET, taskset, scheduler affinity, especially in LXC, Docker and Kubernetes containers.

Unfortunately I don't think there is a way to detect more granular time quotas (in Docker/Kubernetes) as opposed to just restricting available CPUs.

See https://github.com/mratsim/constantine/blob/55785cdb65434933e3b7a5f822262201cb46ebf1/constantine/threadpool/primitives/topology.md

@mratsim mratsim added the enhancement :shipit: New feature or request label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement :shipit: New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant