HeadlinesBriefing favicon HeadlinesBriefing.com

Turn GPU VRAM into Fast Linux Swap with NBD

Hacker News •
×

A new open‑source tool lets Linux users turn an NVIDIA GPU’s VRAM into a swap device. Targeted at laptops that ship with solder‑in memory, the project maps 8 GB of RTX‑series VRAM to a block device via NBD, allowing the kernel to use it as fast, PCIe‑backed swap and expanding available memory capacity significantly for resource‑intensive workloads.

The daemon allocates VRAM through the CUDA driver, then exposes it as /dev/nbdX using the kernel's NBD module. Swap traffic flows: kernel → NBD device → Unix socket → daemon → cuMemcpy transfers. No kernel module or NVIDIA symbols are required, so updates to the driver or kernel do not break the setup for continuous stability and ease of deployment.

On a Pop!_OS system with an RTX 3070 Laptop, allocating 7 GB of VRAM produced a swap space that, combined with zram and SSD, tripled addressable memory to roughly 46 GB. Benchmarks show ~1.3 GB/s sequential throughput, lower latency than NVMe because data travels directly over PCIe to the GPU for memory‑intensive applications that otherwise would swap to the SSD.

Installation is lightweight: a single shell script pulls the repo, compiles the daemon, and starts a systemd service. Users can tune VRAM size and swap priority via environment variables, and the tool respects power state, halting when on battery. With its MIT license, developers can adapt the concept for other CUDA‑capable GPUs in enterprise deployments.