Is it as simple as “Closing your eyes”? and what happens to RAM/VRAM?

Illustration from the original article
There is BSOD in Linux too… Source of the image: r/linux_gaming

Usually we don’t think about it.
We click a button, the screens go black, the fans spin down, and we walk away. But underneath, a massive, high-stakes logistical operation is happening in milliseconds.

Here is the mechanical truth: your system RAM stays powered on, holding your operating system and apps in a suspended state. But your GPU? A modern graphics card has massive amounts of Video RAM (VRAM). To safely enter S3 sleep mode, the graphics driver has to quickly evacuate that entire VRAM payload and dump it directly into your system RAM.

It is called Buffer Eviction.
And yesterday, that exact process completely locked up my machine.

The Problem:

I run a highly optimized Linux Fedora setup on a Ryzen ZEN 5 and an AMD RDNA4 GPU.

I was running alot of processes taking alot of RAM and VRAM at the same time -imagine running VMs and Local LLMs- , I hit the sleep button, and…
the system hard-froze.
The monitors locked up.
The keyboard died.
I had to force-power the machine off, instantly losing my terminal sessions, my code, and my progress.

Random hardware freezes are a direct threat to a your workflow.
I needed to know exactly why the system failed.

Under the Hood:

I started Investigation Instead of guessing, I pulled the system logs from the crashed boot using journalctl.

The kernel was screaming two specific errors right before it died:
kernel: [TTM] Buffer eviction failed
kernel: amdgpu 0000:03:00.0: PM: device_prepare(): pci_pm_prepare returns -12

Illustration from the original article
My system logs

In the Linux kernel, Error -12 translates to -ENOMEM (No Memory).

Illustration from the original article
ENOMEM 12 Cannot allocate memroy Linux Kernel Error.

The math of the crash became obvious. I was pushing my memory hard. Fedora uses zram by default, which acts as a swap space by compressing data inside your physical RAM.

When I hit Sleep, the RDNA4 GPU tried to dump gigabytes of VRAM into my system memory. But my RAM was nearly full, and the zram had nowhere to expand. The hardware literally ran out of microscopic space, the buffer eviction failed, the kernel panicked, and the entire system locked up.

The Fix:

The goal was to engineer a bypass for the memory bottleneck without breaking the speed of my current setup.

Using Btrfs, I allocated a dedicated 18GB physical swapfile directly on my SSD: sudo btrfs filesystem mkswapfile --size 18G /swapfile_18G

I locked it into the filesystem table. The logic is simple: zram continues to handle the lightning-fast, everyday memory compression. But when that massive GPU sleep-state dump happens and RAM maxes out, the system seamlessly spills the overflow into the 18GB safety net on the hard drive.

I tested it immediately. Maxed out the RAM, hit sleep, and the swapfile caught 3.5GB of overflow.
The system slept cleanly and woke up flawlessly.

The Lesson:

When building a complex system, you have to look at the entire board.

A GPU crash wasn’t actually a GPU problem; it was a file system and memory allocation bottleneck.
You can’t troubleshoot hardware in a vacuum.
Everything is interconnected.

Use the logs, find the mechanical truth, fix the root cause, and get back to building.