Bug 2097433

Summary: Change the default value for the DefaultMemoryAccounting variable from 'yes' to 'no'
Product: Red Hat Enterprise Linux 8 Reporter: Nico Pache <npache>
Component: systemdAssignee: systemd-maint
Status: CLOSED WONTFIX QA Contact: Frantisek Sumsal <fsumsal>
Severity: high Docs Contact:
Priority: high    
Version: 8.7CC: aquini, aubaker, bmarson, kwalker, mm-maint, msekleta, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-06-30 11:46:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 2 Michal Sekletar 2022-06-29 09:34:48 UTC
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.

Comment 3 Rafael Aquini 2022-06-29 12:37:54 UTC
(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.

Comment 4 Lukáš Nykrýn 2022-06-29 13:36:48 UTC
(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.

Comment 5 Barry Marson 2022-06-30 00:24:51 UTC
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