Live data from Hacker News

Use your Nvidia GPU's VRAM as swap space on Linux

github.com

31–40 of 142 posts

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#32
What about backpressure, how does it handle requirements for VRAM allocation when VRAM is used for swap space?

With X11 it's not that bad (buffers are pre-allocated), but with Wayland allocations are a lot more dynamic, so running low on VRAM can easily crash the whole desktop. I just had a few of such crashes with Hyprland+llama-server+KVM switching between computers without freeing VRAM.

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#33

You want to waste VRAM, in this economy?

It's 1GiB. What could it cost, $10?

can't stand the thought of people not understanding the above reply[0]

[0]: https://knowyourmeme.com/memes/its-one-banana-michael-what-c...

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#35
post #2

I mean, cool, but I’d rather not?

So don't. Not everything is for you.

Didn't you hear? The author of this daemon is going around and forcibly installing it on anyone's computer that has soldered memory and an Nvidia GPU. I heard even he brings a Ludovico-technique chair with him and straps you in and pins your eyelids open like A Clockwork Orange so you have to watch.

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#36

> Built for laptops with soldered memory and no upgrade path. If you have an RTX card sitting there with 8GB of VRAM and you're getting swapped to SSD, this puts that VRAM to work. Well, that does at least answer my immediate question about why I would ever swap from expensive RAM to really expensive RAM:) Feels niche, but when you want it it's a good idea.

Another possible reason that occurred to me: what if you have VRAM but you're not using it all the time? For example, let's say you bought a GPU because you like to play video games. When you're not actively gaming, you probably don't need 16 GB of VRAM just to render the desktop. Might as well use it for something else, right? Edit: Although, this is predicated on the system being able to release VRAM that is acting…

It's easy enough to 'offline' swap space on Linux normally so I suspect that would work fine, as long as you didn't instantly run out of RAM when doing so.

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#37

Does anyone these days really use swap for anything than S4 suspend ?

It's useful on lower RAM systems as the least frequently used memory can be moved to swap, freeing up more RAM for stuff that needs it. Even when using zram it works out pretty well on my laptop with 8GB of RAM, it'll often have 4GB+ in zram swap space compressed down to only 1GB or so of physical RAM usage.

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#38
I seriously looked at this as a way to improve the RAM situation in a QNAP 2U unit that I was having trouble sourcing RAM for. It's somewhat annoying that legit memory-over-PCIe is gated on PCIe5 and chipset support.

In the end I just had to bite the bullet and take a gamble on finding ECC DDR4 RAM that would work with the ancient AMD chipset...

This particular implementation seems to be running over too many layers to be particularly performant. Why not a custom block driver instead?

Re: Use your Nvidia GPU's VRAM as swap space on Linux

#39
post #24

RAM disks have always fascinated me. In a different timeline every PC has a 100gb of RAM and 50TB HDDs are the norm.

Back when HDDs were all there was ramdisks were interesting, but SSDs pretty much killed most of that as they have massively increased IOPS over disks. Hard drives that huge scare me as it would take days to backup all the data off them.

In my fantasy RAM was the predominate technology over flash.
Post reply on HN