It seems the extremely high memory prices caused by the current AI boom will yet again prolong the rule of 8GB memory in the mainstream graphics cards segment and we’ll have to live with them for far longer. Perhaps that’s why Linux developers have currently come up with improvements for such GPUs. 8GB is also the graphics memory capacity of the upcoming Steam Machine, which will be another beneficiary of such optimizations.
The patches seeking to make gaming on low-end graphics cards with 8GB (or even smaller) VRAM were developed by open-source developers from Valve, Intel and Red Hat. The detailed blogpost by Valve’s Natalie Vock reveals that it should generally improve GPU memory allocation on Linux, which is not optimal currently (at least when using the open-source Radeon drivers, used by Valve’s SteamOS devices, though it seems the operating system’s environment is to blame too).
Gaming on GPUs with limited VRAM is often hampered by the OS letting all the currently running applications but also system’s background processes allocate portions of GPU’s dedicated memory that may grow to tens or hundreds of megabytes for each such task pro app. And that happens even when you are trying to play a game. The blog shows an example where various tasks unrelated to gaming take up to 1829 MB out of the total 8 GB graphics memory and what’s worse, don’t release the memory when a game is launched.

When a Cyberpunk 2077 instance is run for purposes of this demonstration, it only gets allocated 6105 MB and has to use another 1370 MB allocated in the computer’s RAM, which inevitably leads to performance drops and issues due to the much lower performance of RAM.

The solution to these issues lies in a newly added system component called dmem cgroup controller, which uses the cgroups functionality to allocate graphics memory in a more intelligent manner. It makes use of the the fact that each running program gets assigned its own cgroup, which you can individually prioritise for purposes of memory allocation or set its memory allocations as ones that should be preferred and protected from being evicted from VRAM in case other tasks require memory. And that’s exactly what is harming games’ performance currently.
Linux doesn’t currently have a good way to decide which tasks to prioritize with regards to VRAM but Natalie Vock has developed patches that improve the kernel’s handling and also is adapting the plasma-foreground-booster component, which is a KDE tool that automatically tracks which program windows currently has focus on the screen and automatically raises their priority. Originally only CPU scheduling priority of apps was boosted, but with the new patches, the program also boosts the VRAM allocation priority (and adds protected status) to desktop apps with focus. This by itself automatically boosts priority of games that you launch and gives it priority in getting graphics memory over other programs that were left running in the background and may be hogged a significant part of the capacity, like a web browser.
Using this new capability makes the graphics memory allocation code evict the the data of other programs (which are running minimised or offscreen and don’t need VRAM urgently) and give their share to the game being launched. After these patches, the same attempt to launch Cyberpunk 2077 as in the first example ends up with the game getting 7395 MB allocated which is 100 % of what the game itself was requesting. And in turn, the share of VRAM capacity that was taken by other tasks expendable during gaming is greatly lessened.
As a result, the game should run with much smoother framerate without hiccups and frame drops caused by the game requesting its data from the slow system RAM.

Better gaming on Linux and on Steam Machine
This doesn’t necessarily mean that you will get similar improvements if you switch your 8GB GPU-equipped PC to a Linux distribution from Windows. It may just be a spot where the functioning of the Linux graphics stack was a bit weaker rather than discovering some new trick that no other system was using (though it could be interesting to examine how efficient are different operating systems in utilising GPUs with say 8GB memory capacity). Regardless, for Linux users this should be a welcome improvement and it should be quite useful for the upcoming Valve Steam Machine console-ish gaming PC.
Steam Machine runs the Linux-based SteamOS system and uses an 8GB GPU for cost reasons, a card based on the AMD Radeon RX 7600. There were some reservations about the long term viability of that but the system should work at least a little bit better with these improvements in VRAM utilization in place and be better prepared for running more demanding games, whenever it is actually launched (the launch has been postponed because of the memory shortage).
At the moment, the patches are applicable for users running AMD Radeon and Intel Arc GPUs with the opens-source amdgpu and xe drivers, as well as Nvidia GPUs when running the Noveau open-source drivers. That’s because the kernel drivers have to support the dmem cgroups functionality. There seems to also be a systemd dependency. The proprietary Nvidia GeForce drivers usually used by gamers owning Nvidia GPUs don’t support these patches due to dmem cgroups support not being provided.
You also need to install the dmemcg-booster and plasma-foreground-booster (if using KDE/Plasma, like SteamOS does) utilities, dmemcg-booster and the gamescope packaged can be used with other desktop environments. The first part (the dmemcg-booster tool) should only be a temporary measure and should not be needed once the support for the needed cgroups priority settings arrives in the systemd upstream – it’s currently pending as discussions about the design of the relevant interfaces are ongoing.
The prioritization and VRAM allocation patches have not yet been upstreamed to the Linux kernel so you currently need a patched kernel to test or use them.
It’s possible they could get into the SteamOS distribution promptly thanks to the Valve developer relation, and Valve could then push for their upstreaming, so that these improvements become broadly available to users.The distributions will have to adopt the required utilities too though. Currently they are available in CachyOS (when using KDE) since kernel version 7.0rc7-2, and patches are available for Arch too.
Sources: techPowerUp, Github
Jan Olšan, redaktor Cnews.cz
⠀






