Use your Nvidia GPU's VRAM as swap space on Linux
AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Prime Big Deal Days · Oct 6–7Offer from Amazon

Get the latest gadgets delivered free — and shop member deals

  • Fast, free delivery on millions of items
  • Access to Prime Big Deal Days deals on October 6–7
  • Prime Video, Amazon Music and more included
Start your free Prime trial Free trial for eligible customers · Cancel anytime
As an affiliate, we earn on qualifying purchases.

Linux users with Nvidia GPUs can now convert VRAM into swap space using a user-space daemon that leverages CUDA APIs. This approach enhances total addressable memory, especially for hybrid graphics laptops, without kernel module changes. Performance varies depending on workload type.

Linux users with Nvidia GPUs can now utilize their GPU’s VRAM as swap space through a user-space daemon that communicates directly with the CUDA driver API, bypassing kernel module limitations. This development provides a way to significantly increase available memory on hybrid graphics laptops without kernel modifications, which is particularly relevant for systems with soldered, non-upgradable memory.

The method involves a small daemon that allocates VRAM via the CUDA driver API and exposes it as a block device using the NBD (Network Block Device) protocol over a Unix socket. This device is then used as swap space by the Linux kernel. The approach avoids kernel module dependencies and does not require NVIDIA kernel symbols, making it resilient to driver updates. Tested on an AMD/ATI + RTX 3070 laptop with 16 GB RAM and 8 GB VRAM, the setup allocates up to 7 GB of VRAM as swap, effectively tripling total addressable memory when combined with zram and SSD swap. Benchmarks indicate that VRAM-based swap offers lower latency for sporadic, small I/O operations but slower throughput for large sequential transfers compared to NVMe SSDs.

Why It Matters

This development matters because it offers a practical solution for extending system memory on laptops with soldered VRAM, which cannot be upgraded. It enables more demanding applications and multitasking without hardware changes. Additionally, it sidesteps longstanding issues with NVIDIA’s peer-to-peer API restrictions and kernel module dependencies, simplifying implementation and maintenance.

Amazon

Nvidia GPU VRAM as swap space

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background

Prior to this, using GPU memory as swap was limited by NVIDIA driver restrictions and the complexity of direct memory pinning. Existing approaches like nvidia_p2p_get_pages_persistent API often failed on consumer GPUs, returning errors or being gated behind Quadro/datacenter SKUs. The new method leverages CUDA’s memory copy APIs, which are available across consumer GPUs, and implements a user-space daemon to expose VRAM as a block device, effectively creating a high-priority swap device without kernel modifications.

“This approach allows Linux to use Nvidia VRAM as swap without kernel module dependencies or driver modifications, surviving driver updates seamlessly.”

— Developer of the nbd-vram project

“Allocating 7 GB of VRAM as swap tripled the total addressable memory, improving multitasking and application performance.”

— User testing on a laptop with RTX 3070

Amazon

Linux GPU memory extension tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What Remains Unclear

It remains unclear how this approach performs under sustained high load or in different hardware configurations. Compatibility with all Nvidia consumer GPUs and across various Linux distributions has not been exhaustively tested. Additionally, the long-term stability and potential side effects on GPU operation and power management are still being evaluated.

Amazon

CUDA API GPU memory management

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

Further testing across different Nvidia GPU models and Linux distributions is expected. Developers may optimize the daemon for better performance and lower latency. Future updates might include more user-friendly configuration tools and integration with system management utilities. The community will likely explore extending this approach to other GPU brands or integrating it into mainstream Linux distributions.

Amazon

Network Block Device Linux

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

Can I use this method on all Nvidia GPUs?

It works on consumer CUDA-enabled Nvidia GPUs, including RTX and GTX series. Compatibility with older or specialized GPUs has not been fully confirmed.

Does this impact GPU performance or stability?

Initial tests show it does not interfere with normal GPU operation. However, long-term effects and stability under heavy workloads are still being studied.

Is this method safe for my hardware?

Using the CUDA APIs as described is generally safe, but as with any experimental feature, there is a risk of instability. Users should test carefully and back up critical data.

How do I set up this VRAM swap on my Linux system?

Installation involves cloning the GitHub repository, running the provided install script, and configuring systemd services. Detailed instructions are included in the project’s documentation.

Source: Hacker News

FALL

Fall Picks

As an affiliate, we earn on qualifying purchases.

You May Also Like

Space Tech Roundup 2025: New Frontiers in Space Travel

Curious about how 2025’s space tech breakthroughs are transforming exploration and resource harvesting, opening new frontiers beyond Earth’s reach?

HBM Ate the Fab

High Bandwidth Memory (HBM) has become the primary driver of the global memory shortage, replacing traditional RAM and impacting GPU availability.

Htmx 4.0, The First JavaScript Library To Release Exclusively On The Game Boy

Htmx 4.0, a JavaScript library, is released exclusively for the Game Boy, marking the first time such a library is available on this platform.

TIL that 32 bit time will run out in 2038, while 64 bit time will run out approximately 292 billion years from now

The 32-bit Unix time will overflow on January 19, 2038, causing potential system failures. 64-bit systems are unaffected for billions of years.