104
submitted 9 months ago by mr_MADAFAKA@lemmy.ml to c/linux_gaming@lemmy.ml
all 28 comments
sorted by: hot top controversial new old
[-] bjoern_tantau@swg-empire.de 25 points 9 months ago

What I always wonder with things like this, what is the downside? There must be a reason why that value was set lower.

[-] Malix@sopuli.xyz 30 points 9 months ago* (last edited 9 months ago)

Hastily read around in the related issue-threads and seems like on it's own the vm.max_map_count doesn't do much... as long as apps behave. It's some sort of "guard rail" which prevents processes of getting too many "maps". Still kinda unclear what these maps are and what happens is a process gets to have excessive amounts.

That said: https://access.redhat.com/solutions/99913

According to kernel-doc/Documentation/sysctl/vm.txt:

  • This file contains the maximum number of memory map areas a process may have. Memory map areas are used as a side-effect of calling malloc, directly by mmap and mprotect, and also when loading shared libraries.
  • While most applications need less than a thousand maps, certain programs, particularly malloc debuggers, may consume lots of them, e.g., up to one or two maps per allocation.
  • The default value is 65530.
  • Lowering the value can lead to problematic application behavior because the system will return out of memory errors when a process reaches the limit. The upside of lowering this limit is that it can free up lowmem for other kernel uses.
  • Raising the limit may increase the memory consumption on the server. There is no immediate consumption of the memory, as this will be used only when the software requests, but it can allow a larger application footprint on the server.

So, on the risk of higher memory usage, application can go wroom-wroom? That's my takeaway from this.

edit: ofc. I pasted the wrong link first. derrr.

edit: Suse's documentation has some info about the effects of this setting: https://www.suse.com/support/kb/doc/?id=000016692

[-] psycho_driver@lemmy.world 16 points 9 months ago* (last edited 9 months ago)

The default value is 65530

Just checked and the steam deck has it set to 2147483642. My gentoo systems are 65530.

[-] Malix@sopuli.xyz 8 points 9 months ago

On one hand, I'd assume Valve knows what they're doing, but also setting the value that high seems like it's effectively removing the guardrail alltogether. Is that safe, also what is the worst that can happen if an app starts using maps in the billions?

[-] psycho_driver@lemmy.world 17 points 9 months ago

OOM killer is what happens. But that can happen with the default setting as well.

[-] Malix@sopuli.xyz 5 points 9 months ago

no arguments there. Still, I kinda feel that raising the limit high enough to effectively turn off the limit is probably bit overboard. But, if it works, it works, but the kernel devs probably put the limit in place for a reason too.

[-] chepycou@rcsocial.net 9 points 9 months ago

@Malix @psycho_driver From what I can remember this limitation (which either Fedora or Nobara overturned 1yr ago) was set way before video games that take up a lot of memory were a thing.

[-] metiulekm@sh.itjust.works 4 points 9 months ago

I got curious and decided to check this out. This value was set to the current one in 2009: https://github.com/torvalds/linux/commit/341c87bf346f57748230628c5ad6ee69219250e8 The reasoning makes sense, but I guess is not really relevant to our situation, and according to the newest version of the comment 2^16 is not a hard limit anymore.

[-] sugar_in_your_tea@sh.itjust.works 2 points 9 months ago

The whole point is to prevent one process from using too much memory. The whole point of the Steam Deck is to have one process use all the memory.

So it makes sense to keep it relatively low for servers where runaway memory use is a bug that should crash the process, but not in a gaming scenario where high memory usage is absolutely expected.

[-] Aatube@kbin.melroy.org 5 points 9 months ago

no, it'll go vroom-vroom

[-] sugar_in_your_tea@sh.itjust.works 2 points 9 months ago

My read is that it matters for servers where a large number of allocations could indicate a bug/denial of service, so it's better to crash the process.

That's not relevant on a gaming system, since you want one process to be able to use all the resources.

[-] unexposedhazard@discuss.tchncs.de 11 points 9 months ago

It changed it for playing "the finals" some weeks ago to fix a crash. I havent had any issues with my system since then so it really might just be some value that never changed because nothing needed it.

[-] umbrella@lemmy.ml 4 points 9 months ago

also want to know, i increased this value by a lot for gaming and have been using it ever since with no visible repercussions.

[-] mactan@lemmy.ml 4 points 9 months ago

this is great, my lug has a script we have to share around for new Linux users to increase this and it will be nice with more distros having this set high by default

[-] shadowintheday2@lemmy.world 4 points 9 months ago* (last edited 9 months ago)

Arch is having internal discussions to increase it. Might be something upstream may adopt if all major distributions end up increasing it.

[-] penquin@lemm.ee 4 points 9 months ago
[-] psycho_driver@lemmy.world 9 points 9 months ago* (last edited 9 months ago)

What should it be set to?

The steam deck has it set to 2147483642.

[-] shadowintheday2@lemmy.world 6 points 9 months ago

Also known as (close) to max signed int32

[-] gaael@lemmy.world 3 points 9 months ago

That's also the default value on Garuda (arch-based, gaming-oriented)

[-] penquin@lemm.ee 1 points 9 months ago

This sounds like a massive number. Also, I don't even have this sysctl.conf on my endeavouros install! I had to create one and add this value to it

[-] DeaDSouL@lemmy.ml 4 points 9 months ago

To 1048576.

[-] sirsquid@lemmy.ml 1 points 9 months ago

@mr_MADAFAKA@lemmy.ml I saw that you shared it on reddit earlier, but the post is gone, did the mods just nuke it?

[-] mr_MADAFAKA@lemmy.ml 2 points 9 months ago

I delete it, was looking through some old post and accidentally delete it

[-] sirsquid@lemmy.ml 1 points 9 months ago* (last edited 9 months ago)

Ah okay, thought the mods were doing their thing again, they do keep removing gol posts <_<, i deleted my reddit account - all in on lemmy and fediverse now (but appreciate you sharing it there!)

[-] rawfox@lemmy.ml 1 points 9 months ago

Raise it ! There is only benefits for your gaming experience in Linux.

[-] Unyieldingly@lemmy.world 1 points 9 months ago

Fedora changed it as well some time back you can use sudo sysctl -w vm.max_map_count=2147483642 to match the SteamDeck with Fedora.

this post was submitted on 26 Mar 2024
104 points (97.3% liked)

Linux Gaming

16076 readers
39 users here now

Gaming on the GNU/Linux operating system.

Recommended news sources:

Related chat:

Related Communities:

Please be nice to other members. Anyone not being nice will be banned. Keep it fun, respectful and just be awesome to each other.

founded 4 years ago
MODERATORS