1467f69191
Add cgroup memory limits to the jenkins_slave module. Nodes including jenkins_slave::cgroups will have the jenkins user's processes limited to use only 90% of the nodes available memory. There are two exceptions to this. The jenkins process run by the jenkins user will not have its memory capped. Also there is a soft memory limit of total physical memory * 0.75. If there is memory contention the jenkins user processes may get only 75% of available memory. Change-Id: If4a6439b536df4003d74fd1a93686c1c2401ae20
39 lines
697 B
Plaintext
39 lines
697 B
Plaintext
mount {
|
|
cpu = /sys/fs/cgroup/cpu;
|
|
cpuacct = /sys/fs/cgroup/cpuacct;
|
|
devices = /sys/fs/cgroup/devices;
|
|
memory = /sys/fs/cgroup/memory;
|
|
freezer = /sys/fs/cgroup/freezer;
|
|
}
|
|
|
|
group jenkins {
|
|
perm {
|
|
task {
|
|
uid = jenkins;
|
|
gid = jenkins;
|
|
}
|
|
admin {
|
|
uid = root;
|
|
gid = root;
|
|
}
|
|
}
|
|
}
|
|
|
|
group jenkins/children {
|
|
perm {
|
|
task {
|
|
uid = jenkins;
|
|
gid = jenkins;
|
|
}
|
|
admin {
|
|
uid = root;
|
|
gid = root;
|
|
}
|
|
}
|
|
memory {
|
|
memory.soft_limit_in_bytes = <%= (memorytotalbytes.to_f * 0.75).to_i %>;
|
|
memory.limit_in_bytes = <%= (memorytotalbytes.to_f * 0.9).to_i %>;
|
|
memory.memsw.limit_in_bytes = <%= (memorytotalbytes.to_f * 0.9).to_i %>;
|
|
}
|
|
}
|