Give Linux a memory limit that the low-memory handling can read.

Linux overcommits, so plat_commit_enforced was 0 there and nothing the runtime does when memory runs short
ever ran: no stale-texture drops, no idle or disuse eviction. plat_commit_info on Linux now reports the
limit with the least headroom of the cgroup v2 limits the process lives under (memory.max, memory.high,
against memory.current less its file cache), the machine's RAM (MemAvailable against MemTotal) and, with
vm.overcommit_memory = 2, the commit limit; a read is reused for 250 ms and the first one is logged. The
spare VRAM blocks stand down under low memory only where device memory counts against that limit
(plat_commit_counts_vram: Windows, and any integrated GPU). Windows behaves as before.

Pull request #378 by mooki000, taken as it is. The Windows files compile; the Linux code is not compiled
or run here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-10 06:20:03 -05:00
parent 19eeb29cda
commit b2c5052ff5
7 changed files with 259 additions and 28 deletions

View File

@@ -113,7 +113,8 @@
# 1: very large compute shaders that no cache holds are built on one background thread after the start. 0: each is
# built when the game first uses it, which can hold that frame for a second or two.
# lib_prebuild_big_bg = 1
# The commit headroom in MB those background builds wait for (0: no check).
# The commit headroom in MB those background builds wait for (0: no check). On Linux the headroom is the smaller of
# the room left under the cgroup's memory limit (memory.max, memory.high) and the memory available on the machine.
# big_build_free_mb = 8192
# How far those background builds may raise the process commit in MB before the rest wait for their first use instead
# (0: no limit). Each large shader costs the driver 1-4 GB; on a 31 GB machine four of them took the process from 15 to
@@ -190,7 +191,8 @@
# tex_vram_pressure = 80
# Megabytes this process may commit before textures give way as they do while the system's commit runs low (Windows
# counts video memory against the commit). Default: the installed memory, at least 24576, so that it does not depend
# on the size of the page file. 0: no bound of its own; only the system's commit counts.
# on the size of the page file. 0: no bound of its own; only the system's commit counts. On Linux it counts the
# process's resident anonymous memory, which stays under the installed memory, so there only a smaller value holds.
# tex_proc_commit_mb = 32768
# 1: a texture the game releases or takes back, with nothing else changed at its address, puts the texture table's
# slots there back in a state they were in before, and they are not all looked up again (large towns release and take