r/kernel • • 27d ago

Offloading zram compression to GPU?

Is there a way to offload zram compression & decompression to the GPU?

I have a compilation server with 36 logical cores but only 16GB of RAM (I am unable to upgrade due to the global RAM crisis; DDR4 registered ECC costs a ton). In an effort to squeeze more "RAM" out of my RAM, I decided to start using zram compressed with zstd.

I managed to get 48GB of zram to work (3:1 compression), however it resulted in one of my cores being pinned at 100%, desperately trying to compress the increasing amount of ram being used by 36 compile jobs. Is there a way to offload this to the GPU? I think it would greatly speed up compilation if possible, and would perhaps allow for a greater compression rate (zstd ultra maybe???)

EDIT: The GPU is a GTX 1660 Super with the open-source kernel modules from NVIDIA. It basically never gets used and usage is at a constant 0-1%

19 Upvotes

15 comments sorted by

View all comments

2

u/Ok_Green5623 27d ago

I don't think your problem is speed of compression. You will never be able to load your cores with compilation work, because compilation tend to use a lot of ram especially with higher optimization levels. If you need like 32-40GB of RAM to utilize your cores, no matter what you do - you will be heavily throttled by paging in and out. Just limit parallelism and use your CPU at 20-40% before it heats the RAM limit and it will be faster.