Increase default vm.max_map_count value

Bug Report

Hardware: Custom desktop PC
OS Version: 6.0
Locale: N/A
Application: Many games on Wine/Proton or emulated

== Description: ==
This is a proposal to increase the value of the vm.max_map_count sysctl parameter (https://sysctl-explorer.net/vm/max_map_count/) to improve the default gaming experience in EndlessOS. This is the same change that was done on Fedora a year ago, more details in this link: https://fedoraproject.org/wiki/Changes/IncreaseVmMaxMapCount

Context

3D games often need to make hundreds of thousands of memory allocations, orders of magnitude more than most other programs. In doing so, they may hit the Kernel’s default limit of 65536 on vm.max_map_count, causing the program to crash. This is known to affect some Windows games running on Wine/Proton, like: Counter-Strike 2, DayZ, Hogwarts Legacy, but also console emulators like Ryujinx (attached below is a screenshot of the warning displayed by Ryujinx on startup).

The value can be queried and changed at runtime with the sysctl command (changing requires root privilege):

# Read current value
sysctl vm.max_map_count

# Change value to 1048576 for the current session
sudo sysctl -w vm.max_map_count=1048576

Users can make the change persistent across boots by creating a config file at /etc/sysctl.d/10-map-count.conf with the following contents:

# Increase the number of virtual memory areas that one process may request
vm.max_map_count=1048576

Change proposal

This proposal is for EndlessOS to change its default value to vm.max_map_count=1048576 for a better “out-of-the-box” gaming experience. This can be done by shipping the same config file above at /usr/lib/sysctl.d/10-map-count.conf

The value 1048576 was chosen by Fedora as both sufficient for all known affected programs, and safe against DoS abuse on systems from 2GB RAM. Some discussion of this default value can be read on the FESCo issue: https://pagure.io/fesco/issue/2993

== Steps to Reproduce: ==

  1. Verify that the value of vm.max_map_count is the default of 65536
  2. Start one of the affected games and play until it crashes
  3. Increase value vm.max_map_count=1048576
  4. Start the game again and verify that it no longer crashes.

== Expected Results: ==
The games are not expected to crash for a good “out-of-the-box” gaming experience

== Actual Results: ==
Games may present crashes until users manually change a sysctl parameter as root.

== Logs: ==
N/A

== Screenshots: ==

![ryujinx-warning-max_map_count|608x326]()

(links and images removed from post due to forum restrictions)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.