I want to disable transparent_hugepage (THP) on a CentOS 7 EC2 instance, which is enabled by default:
# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
# cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
This setting can be manually changed:
# echo never > /sys/kernel/mm/transparent_hugepage/enabled
# echo never > /sys/kernel/mm/transparent_hugepage/defrag
# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
# cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]
... but the changes are lost after reboot.
I tried to put the echo never [...]
instruction into my rc.local
and cloud.cfg
files, but it didn't work.
I also tried to append the setting transparent_hugepage=never
to the kernel line of /etc/grub.conf
(as explained there), but it didn't work better.
So... how can I disable THP on CentOS 7 running on an AWS EC2 instance ?
edit: changed title... I need to disable THP and THP defrag