Hi guys,
I'm currently studying for the RHCE and one of the topics is system optimization. I'm trying to set "vm.swappiness" to a non-default setting.
First, I've created a swappiness.conf file in "/etc/sysctl.d" and removed the link pointing to the sysctl.conf file - on reboot it doesn't do it. (sysctl -p and systemctl restart systemd-sysctl works).
Then, I decided to revert all changes and enter vm.swappiness=<digit> in sysctl.conf file (with and without empty spaces around the "=") and after each reboot - swappiness was set to default.After a "systemctl restart systemd-sysctl or with "sysctl -p sysctl.conf" - everything seems to be ok.
I'm using CentOs 7.2 with kernel 3.10.0-327.3.1
I'm out of any ideas.
Thanks for your time reading this long post.
Best Regards,
Strahil Nikolov
CentOs7 vm.swappiness cannot be set on boot
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: CentOs7 vm.swappiness cannot be set on boot
I've tried with net.ipv4.ip_forward = 1 and it worked. It seems that systemd-systemctl.service is started too early and it can't change the swappiness level.
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: CentOs7 vm.swappiness cannot be set on boot
Update:
I've just tested the 2 tunables under Centos 7.0 and it worked.
I've just tested the 2 tunables under Centos 7.0 and it worked.
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: CentOs7 vm.swappiness cannot be set on boot
It looks like a bug and I've reported it as https://bugs.centos.org/view.php?id=10045.
Re: CentOs7 vm.swappiness cannot be set on boot
Works fine here via /etc/sysctl.conf. Perhaps there is something that sets swappiness back to the default after sysctl has set the custom value? grep -r swappiness /etc may give you some clues.
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: CentOs7 vm.swappiness cannot be set on boot
I've tested it today.
In CentOs 7.0 - works fine, in 7.0 with latest kernel - still OK.
In CentOs7.0 updated to -> 7.2 - not working.
In CentOs7.2 from DVD with no updates - not working.
It just seems to be a bug. For kernel tunables only sysctl config files (located in /etc/sysctl.d/ folder , and /etc/sysctl.conf) should change these parameters. On 7.2 after restart of systemd-sysctl everything works fine.
In CentOs 7.0 - works fine, in 7.0 with latest kernel - still OK.
In CentOs7.0 updated to -> 7.2 - not working.
In CentOs7.2 from DVD with no updates - not working.
It just seems to be a bug. For kernel tunables only sysctl config files (located in /etc/sysctl.d/ folder , and /etc/sysctl.conf) should change these parameters. On 7.2 after restart of systemd-sysctl everything works fine.
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: CentOs7 vm.swappiness cannot be set on boot
Ok,
here is the reson why the swappiness got changed. In my tune profile there is a setting for vm.swappiness which overrides the sysctl setting.The settings for the different profiles are in /usr/lib/tuned.
here is the reson why the swappiness got changed. In my tune profile
Code: Select all
# tuned-adm active