From d8234620109cf0f69089f37ca94c4fab22c0560f Mon Sep 17 00:00:00 2001 From: The 8472 Date: Thu, 9 Jun 2022 20:52:17 +0200 Subject: add cgroupv1 support to available_parallelism --- library/std/src/thread/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'library/std/src/thread') diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 7f9b297e9dc..f02a7de04e5 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -1571,7 +1571,7 @@ fn _assert_sync_and_send() { /// /// On Linux: /// - It may overcount the amount of parallelism available when limited by a -/// process-wide affinity mask or cgroup quotas and cgroup2 fs or `sched_getaffinity()` can't be +/// process-wide affinity mask or cgroup quotas and `sched_getaffinity()` or cgroup fs can't be /// queried, e.g. due to sandboxing. /// - It may undercount the amount of parallelism if the current thread's affinity mask /// does not reflect the process' cpuset, e.g. due to pinned threads. -- cgit 1.4.1-3-g733a5 From 2e33c812e8b1bea563893f17ff5edcb7023d5d41 Mon Sep 17 00:00:00 2001 From: the8472 Date: Fri, 22 Jul 2022 22:18:07 +0200 Subject: [review] mention that runtime may scale with # of mountpoints Co-authored-by: Josh Triplett --- library/std/src/thread/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'library/std/src/thread') diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index f02a7de04e5..add93b618a6 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -1575,6 +1575,11 @@ fn _assert_sync_and_send() { /// queried, e.g. due to sandboxing. /// - It may undercount the amount of parallelism if the current thread's affinity mask /// does not reflect the process' cpuset, e.g. due to pinned threads. +/// - If the process is in a cgroup v1 cpu controller, this may need to +/// scan mountpoints to find the corresponding cgroup v1 controller, +/// which may take time on systems with large numbers of mountpoints. +/// (This does not apply to cgroup v2, or to processes not in a +/// cgroup.) /// /// On all targets: /// - It may overcount the amount of parallelism available when running in a VM -- cgit 1.4.1-3-g733a5