Skip to content

Instantly share code, notes, and snippets.

@chrisdone
Created August 8, 2018 13:56
Show Gist options
  • Save chrisdone/9d99124f8ed5787b9de94ba3621cd376 to your computer and use it in GitHub Desktop.
Save chrisdone/9d99124f8ed5787b9de94ba3621cd376 to your computer and use it in GitHub Desktop.
Set cgroup limits on a process
# Create the group
sudo cgdelete memory:/emacs # Recreating it when making changes seems to help them take effect
sudo cgcreate -g memory:/emacs -t chris:chris
sudo cgset -r memory.swappiness=0 emacs
sudo cgset -r memory.limit_in_bytes=1GB emacs
# Run the process with memory limits
cgexec -g memory:emacs emacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment