Merge "Don't use mem cgroups for pid accounting." into nyc-dev
This commit is contained in:
commit
e9ea8db617
1 changed files with 7 additions and 0 deletions
|
|
@ -37,6 +37,9 @@
|
||||||
|
|
||||||
#include <processgroup/processgroup.h>
|
#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_PATH "/dev/memcg/apps"
|
||||||
#define MEM_CGROUP_TASKS "/dev/memcg/apps/tasks"
|
#define MEM_CGROUP_TASKS "/dev/memcg/apps/tasks"
|
||||||
#define ACCT_CGROUP_PATH "/acct"
|
#define ACCT_CGROUP_PATH "/acct"
|
||||||
|
|
@ -67,6 +70,7 @@ struct ctx {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* getCgroupRootPath() {
|
static const char* getCgroupRootPath() {
|
||||||
|
#ifdef USE_MEMCG
|
||||||
static const char* cgroup_root_path = NULL;
|
static const char* cgroup_root_path = NULL;
|
||||||
std::call_once(init_path_flag, [&]() {
|
std::call_once(init_path_flag, [&]() {
|
||||||
// Check if mem cgroup is mounted, only then check for write-access to avoid
|
// Check if mem cgroup is mounted, only then check for write-access to avoid
|
||||||
|
|
@ -75,6 +79,9 @@ static const char* getCgroupRootPath() {
|
||||||
ACCT_CGROUP_PATH : MEM_CGROUP_PATH;
|
ACCT_CGROUP_PATH : MEM_CGROUP_PATH;
|
||||||
});
|
});
|
||||||
return cgroup_root_path;
|
return cgroup_root_path;
|
||||||
|
#else
|
||||||
|
return ACCT_CGROUP_PATH;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int convertUidToPath(char *path, size_t size, uid_t uid)
|
static int convertUidToPath(char *path, size_t size, uid_t uid)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue