3

Trying to permanently change some vm kernel parameters, I created /etc/sysctl.d/01-custom.conf config file as it described in Red Hat knowledgebase article. Here is its content:

# cat /etc/sysctl.d/01-custom.conf
vm.swappiness=10
vm.dirty_ratio=20
vm.vfs_cache_pressure=200

But after reboot only vm.vfs_cache_pressure is changed and swappines and dirty_ratio have previous values.

# sysctl vm.swappiness
vm.swappiness = 30
# sysctl vm.dirty_ratio
vm.dirty_ratio = 30

In /etc/sysctl.conf file there is no changes for vm.dirty_ratio parameter and vm.swappines is set to 10 as well. Does it mean that the system takes these values from somewhere else? There are no any config files under /etc/sysctl.d besides mine and link to /etc/sysctl.conf:

# ll /etc/sysctl.d/
total 4
-rw-r--r--  1 root root 147 May 30 04:40 01-custom.conf
lrwxrwxrwx. 1 root root  14 Apr  3 15:00 99-sysctl.conf -> ../sysctl.conf

Update: sysctl --system shows that values from my config were taken. Nothing for vm.swappines and vm.dirty_ratio are set to 30.

8
  • 2
    If you run sysctl -p, will the values you wanted come into effect? If so, it might be that the sysctl settings are applied in initramfs phase of the boot, and you'll just need to rebuild your initramfs to make the changes happen automatically at boot time.. – telcoM May 30 '18 at 9:27
  • 1
    Several parameters can be achieved from /lib/sysctl.d/ directory. Maybe your parameters is stored there. All available paths you can get from man 5 sysctl.conf in FILES section. – Yurij Goncharuk May 30 '18 at 9:31
  • @telcoM, yes, running sysctl -p changes values but only till the reboot. – sys463 May 30 '18 at 9:35
  • Thanks @YurijGoncharuk. I've checked all the directories that are listed in man for sysctl.conf and found out a few more configs - nothing for swappines or dirty_ratio set to 30. Also, I checked with sysctl --system - updated description. – sys463 May 30 '18 at 9:58
  • @telcoM, strange, but rebuilding initramfs didn't help.. – sys463 May 30 '18 at 10:43
0

If you are running tuned, it will take precedence over sysctl: Sysctl.conf parameters overridden by Tuned

Check if tuned is running:

systemctl status tuned

If it is running, check which profile is active:

tuned-adm active

Tuned's profiles can be found in /usr/lib/tuned/:

# grep -ri '^vm.swappiness' /usr/lib/tuned/
/usr/lib/tuned/latency-performance/tuned.conf:vm.swappiness=10
/usr/lib/tuned/throughput-performance/tuned.conf:vm.swappiness=10
/usr/lib/tuned/virtual-guest/tuned.conf:vm.swappiness = 30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.