Merge "Don\'t use mem cgroups for pid accounting." into nyc-dev
am: e9ea8db
* commit 'e9ea8db617f52ddaa51e3b6fb9663e2f9b069425':
Don't use mem cgroups for pid accounting.
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp
index ba97f32..cfc9ae2 100644
--- a/libprocessgroup/processgroup.cpp
+++ b/libprocessgroup/processgroup.cpp
@@ -38,6 +38,9 @@
#include <processgroup/processgroup.h>
+// Uncomment line below use memory cgroups for keeping track of (forked) PIDs
+// #define USE_MEMCG 1
+
#define MEM_CGROUP_PATH "/dev/memcg/apps"
#define MEM_CGROUP_TASKS "/dev/memcg/apps/tasks"
#define ACCT_CGROUP_PATH "/acct"
@@ -68,6 +71,7 @@
};
static const char* getCgroupRootPath() {
+#ifdef USE_MEMCG
static const char* cgroup_root_path = NULL;
std::call_once(init_path_flag, [&]() {
// Check if mem cgroup is mounted, only then check for write-access to avoid
@@ -76,6 +80,9 @@
ACCT_CGROUP_PATH : MEM_CGROUP_PATH;
});
return cgroup_root_path;
+#else
+ return ACCT_CGROUP_PATH;
+#endif
}
static int convertUidToPath(char *path, size_t size, uid_t uid)