aboutsummaryrefslogtreecommitdiff
path: root/src/unix/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/core.c')
-rw-r--r--src/unix/core.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/unix/core.c b/src/unix/core.c
index 115cbe69..bd51b69b 100644
--- a/src/unix/core.c
+++ b/src/unix/core.c
@@ -2046,14 +2046,11 @@ unsigned int uv_available_parallelism(void) {
#ifdef __linux__
{
- double rc_with_cgroup;
- uv__cpu_constraint c = {0, 0, 0.0};
+ long long quota = 0;
- if (uv__get_constrained_cpu(&c) == 0 && c.period_length > 0) {
- rc_with_cgroup = (double)c.quota_per_period / c.period_length * c.proportions;
- if (rc_with_cgroup < rc)
- rc = (long)rc_with_cgroup; /* Casting is safe since rc_with_cgroup < rc < LONG_MAX */
- }
+ if (uv__get_constrained_cpu(&quota) == 0)
+ if (quota > 0 && quota < rc)
+ rc = quota;
}
#endif /* __linux__ */