Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

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: rcFlags: pm-rhel: mirror+
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