Redhat and Centos have the command "tuned-adm" which has various machine profiles with settings like this. It is an official thing supported by the vendor.
https://access.redhat.com/site/documentation/en-US/Red_Hat_E...
eg when I run it on one of our KVM hosts.
$ tuned-adm list
Available profiles:
- throughput-performance
- laptop-ac-powersave
- virtual-guest
- latency-performance
- enterprise-storage
- default
- spindown-disk
- desktop-powersave
- virtual-host
- laptop-battery-powersave
- server-powersave
Current active profile: virtual-host