Skip to content

Instantly share code, notes, and snippets.

@PyYoshi
Last active June 13, 2018 22:46
Show Gist options
  • Save PyYoshi/a7ca64b6c92b5ef1834b to your computer and use it in GitHub Desktop.
Save PyYoshi/a7ca64b6c92b5ef1834b to your computer and use it in GitHub Desktop.
Disable Transparent Huge Pages on CoreOS
$ sudo -i
# vim /etc/systemd/system/disable-transparent-huge-pages.service
# systemctl enable disable-transparent-huge-pages
# systemctl start disable-transparent-huge-pages
# systemctl status disable-transparent-huge-pages
# cat /sys/kernel/mm/transparent_hugepage/enabled
# cat /sys/kernel/mm/transparent_hugepage/defrag
[Unit]
Description=Disable Transparent Huge Pages
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c "/usr/bin/echo "never" | tee /sys/kernel/mm/transparent_hugepage/enabled"
ExecStart=/usr/bin/sh -c "/usr/bin/echo "never" | tee /sys/kernel/mm/transparent_hugepage/defrag"
[Install]
WantedBy=multi-user.target
@Benjamin-Dobell
Copy link

If you're a Ubuntu 16.04 user and stumble across this like I did, then for Ubuntu 16.04; in disable-transparent-huge-pages.service simply replace instances of /usr/bin with /bin.

@erkolson
Copy link

The quoting as displayed here does not work. I removed the quotes around "never" but perhaps escaping them would work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment