r/kernel • • Nov 03 '26

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%

18 Upvotes

15 comments sorted by

View all comments

Show parent comment

3

u/Thin_Dragonfruit2254 Nov 03 '26

Does anyone knows how the tests were executed? I built the kernel with the patch but I would like to compare the stock kernel with the new one.

3

u/Thin_Dragonfruit2254 Nov 03 '26

Got it:

fio --name=zram-mixed-test \
--filename=/dev/zram0 \
--direct=1 \
--rw=randrw \
--rwmixread=70 \
--bs=4k \
--ioengine=libaio \
--iodepth=32 \
--numjobs=16 \
--runtime=60 \
--time_based \
--group_reporting

3

u/_gaff 27d ago edited 27d ago

What were your findings? Please consider sending a Tested-by if you have meaningful findings

2

u/Thin_Dragonfruit2254 26d ago

I need a better setup to test it properly.. but there are improvements..
I'll post here when I get it done.