Actually, changing the default in systemd might not help because MemoryAccounting can be enabled implicitly when some units contains memory cgroup related limit option (e.g. MemoryMax). I think that proposed kernel solution is better approach and would be consistent with how this works with cgroup v2, i.e. no per cgroup swappiness.
(In reply to Michal Sekletar from comment #2) > Actually, changing the default in systemd might not help because > MemoryAccounting can be enabled implicitly when some units contains memory > cgroup related limit option (e.g. MemoryMax). I think that proposed kernel > solution is better approach and would be consistent with how this works with > cgroup v2, i.e. no per cgroup swappiness. The fundamental problem, as I understand it, in this case is the fact that systemd slices are initially created with the default vm.swappiness value, instead of picking the value set up in sysctl.conf. The problem that systemd slices are creating affect users that still think they're running their apps without cgroups, and tuning the system in a global fashion (by tweaking sysctl knobs directly, as opposed to using units). So, I think a better approach, perhaps, would be making sure systemd does not create its slices before the sysctls are adjusted accordingly to what is set in sysctl.conf by the user We should try avoid patching the kernel to band-aid this corner case created by the decision that everything concealed runs within a cgroup.
(In reply to Rafael Aquini from comment #3) > (In reply to Michal Sekletar from comment #2) > > Actually, changing the default in systemd might not help because > > MemoryAccounting can be enabled implicitly when some units contains memory > > cgroup related limit option (e.g. MemoryMax). I think that proposed kernel > > solution is better approach and would be consistent with how this works with > > cgroup v2, i.e. no per cgroup swappiness. > > The fundamental problem, as I understand it, in this case is the fact that > systemd slices are initially created with the default vm.swappiness value, > instead of picking the value set up in sysctl.conf. > > The problem that systemd slices are creating affect users that still think > they're running their apps without cgroups, and tuning the system in a global > fashion (by tweaking sysctl knobs directly, as opposed to using units). > So, I think a better approach, perhaps, would be making sure systemd does not > create its slices before the sysctls are adjusted accordingly to what is set > in > sysctl.conf by the user This is unfortunately not possible to do due to systemd's design. We need to create the root cgroup before we run anything, that includes systemd-sysctl. > > We should try avoid patching the kernel to band-aid this corner case created > by the decision that everything concealed runs within a cgroup.
Additionally, this is not just about getting vm.swappiness from a sysctl.conf. Tuned actually sets it in key profiles and of course the value can be changed at anytime. /usr/lib/tuned/accelerator-performance/tuned.conf:vm.swappiness=10 /usr/lib/tuned/latency-performance/tuned.conf:vm.swappiness=10 /usr/lib/tuned/throughput-performance/tuned.conf:vm.swappiness=10 Barry