collectors/cgroups: fix cpuset.cpus count (#10757)
Ilya Mashchenko committed
Mar 12, 2021 at 15:27 UTC
42c23f45a228e80c182fc6ea684b92c606c924ee
1 file changed
+2
-2
collectors/cgroups.plugin/sys_fs_cgroup.c
+2
-2
@@ -2948,15 +2948,15 @@ static inline void update_cpu_limits(char **filename, unsigned long long *value,
2948
// parse the cpuset string and calculate the number of cpus the cgroup is allowed to use
2949
while(*s) {
2950
unsigned long long n = cpuset_str2ull(&s);
2951
+ ncpus++;
2952
if(*s == ',') {
2953
s++;
2953
- ncpus++;
2954
continue;
2955
}
2956
if(*s == '-') {
2957
s++;
2958
unsigned long long m = cpuset_str2ull(&s);
2959
- ncpus += m - n + 1; // calculate the number of cpus in the region
2959
+ ncpus += m - n; // calculate the number of cpus in the region
2960
}
2961
s++;
2962
}