Why does this tunable exist?
There is no architectural equivalent on Windows or macOS (/other Apple-derived operating systems). Within a given memory range, you can map the same file as many times as you want.
It doesn't correspond to any limit that isn't already tracked through another means (like the nofile
limit for open files). It doesn't correspond to a scarce physical resource. It doesn't even prevent page table fragmentation. You can severely fragment memory mapped pages by unmapping every other page, but given a sufficiently low vm.max_map_count
, it is impossible to do this by mapping pages into a sparse region.
Software like Elasticsearch regularly has to deal with this ridiculous restriction. But the default limit should not just be raised to a more sensible default than 65530. It has no function in the kernel and should be removed entirely.