summaryrefslogtreecommitdiffstats
path: root/collectors/cgroups.plugin/sys_fs_cgroup.c
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-02-02 00:14:35 +0200
committerGitHub <noreply@github.com>2023-02-02 00:14:35 +0200
commit55d1f00bb7c2403b451947b2a225b5d1f6be9183 (patch)
tree043e57edb64b319b1eb6a883d6980fa2d9dd2c8e /collectors/cgroups.plugin/sys_fs_cgroup.c
parent2e56e2b87622a102aef876d297a3cd80d35028e5 (diff)
DBENGINE v2 - improvements part 12 (#14379)
* parallel initialization of tiers * do not spawn multiple dbengine event loops * user configurable dbengine parallel initialization * size netdata based on the real cpu cores available on the system netdata runs, not on the system monitored * user configurable system cpus * move cpuset parsing to os.c/.h * fix replication of misaligned chart dimensions * give a different path to each tier thread * statically allocate the path into the initialization structure * use aral for reusing dbengine pages * dictionaries uses ARAL for fixed sized values * fix compilation without internal checks * journal v2 index uses aral * test to see judy allocations * judy allocations using aral * Add config option to select if dbengine will use direct I/O (default is yes) * V1 journafiles will use uv_fs_read instead of mmap (respect the direct I/O setting) * Remove sqlite3IsMemdb as it is unused * Fix compilation error when --disable-dbengine is used * use aral for dbengine work_cmds * changed aral API to support new features * pgc and mrg aral overheads * rrdeng opcodes using aral * better structuring and naming * dbegnine query handles using aral * page descriptors using aral * remove obsolete linking * extent io descriptors using aral * aral keeps one last page alive * add missing return value * added judy aral overhead * pdc now uses aral * page_details now use aral * epdl and deol using aral - make sure ARALs are initialized before spawning the event loop * remove unused linking * pgc now uses one aral per partition * aral measure maximum allocation queue * aral to allocate pages in parallel * aral parallel pages allocation when needed * aral cleanup * track page allocation and page population separately --------- Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
Diffstat (limited to 'collectors/cgroups.plugin/sys_fs_cgroup.c')
-rw-r--r--collectors/cgroups.plugin/sys_fs_cgroup.c45
1 files changed, 4 insertions, 41 deletions
diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c
index 9f9178c367..d312f44300 100644
--- a/collectors/cgroups.plugin/sys_fs_cgroup.c
+++ b/collectors/cgroups.plugin/sys_fs_cgroup.c
@@ -3516,52 +3516,15 @@ static inline char *cgroup_chart_type(char *buffer, const char *id, size_t len)
return buffer;
}
-static inline unsigned long long cpuset_str2ull(char **s) {
- unsigned long long n = 0;
- char c;
- for(c = **s; c >= '0' && c <= '9' ; c = *(++*s)) {
- n *= 10;
- n += c - '0';
- }
- return n;
-}
-
static inline void update_cpu_limits(char **filename, unsigned long long *value, struct cgroup *cg) {
if(*filename) {
int ret = -1;
if(value == &cg->cpuset_cpus) {
- static char *buf = NULL;
- static size_t buf_size = 0;
-
- if(!buf) {
- buf_size = 100U + 6 * get_system_cpus(); // taken from kernel/cgroup/cpuset.c
- buf = mallocz(buf_size + 1);
- }
-
- ret = read_file(*filename, buf, buf_size);
-
- if(!ret) {
- char *s = buf;
- unsigned long long ncpus = 0;
-
- // parse the cpuset string and calculate the number of cpus the cgroup is allowed to use
- while(*s) {
- unsigned long long n = cpuset_str2ull(&s);
- ncpus++;
- if(*s == ',') {
- s++;
- continue;
- }
- if(*s == '-') {
- s++;
- unsigned long long m = cpuset_str2ull(&s);
- ncpus += m - n; // calculate the number of cpus in the region
- }
- s++;
- }
-
- if(likely(ncpus)) *value = ncpus;
+ unsigned long ncpus = read_cpuset_cpus(*filename, get_system_cpus());
+ if(ncpus) {
+ *value = ncpus;
+ ret = 0;
}
}
else if(value == &cg->cpu_cfs_period) {