Skip to content

Instantly share code, notes, and snippets.

@victoredwardocallaghan
Last active December 24, 2015 00:19
Show Gist options
  • Save victoredwardocallaghan/6716253 to your computer and use it in GitHub Desktop.
Save victoredwardocallaghan/6716253 to your computer and use it in GitHub Desktop.
cgroup browers since they suck, literally! # systemctl enable cgrules.service cgconfig.service # systemctl start cgrules.service cgconfig.service
# /etc/cgconfig.conf
####################
# Prevent Web Browsers from taking all memory
# $ cgexec -g memory,cpuset:browser /usr/bin/firefox
#
group browser {
perm {
# who can manage limits
admin {
uid = edward;
gid = root;
}
# who can add tasks to this group
task {
uid = edward;
gid = users;
}
}
# create this group in cpuset and memory controllers
cpuset {
cpuset.cpus = 0-1;
cpuset.mems = 0;
# cpuset.memory_pressure_enabled = 1;
}
memory {
memory.limit_in_bytes = 3G;
# memory.memsw.limit_in_bytes = 4G;
# memory.soft_limit_in_bytes = 3G;
memory.swappiness = 5;
# dont kill brower if it sucks up all resources, notify me
memory.oom_control = 1;
# memory.pressure_level = medium;
}
}
# /etc/cgrules.conf
####################
@users:firefox cpuset,memory browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment