foundObjects / zram-swap

A simple zram swap service for modern systemd Linux
MIT License
310 stars 42 forks source link

Passing options to compression algorithms #12

Closed mortezae closed 2 months ago

mortezae commented 2 years ago

Is it possible to use e.g. 3 cores for zstd? I tried "zstd -12 -T3" but it considered as invalid argument. And what is the default compression level? Thanks a lot

foundObjects commented 1 year ago

I don't believe the zram module allows you to configure compression level, it just picks the default level for each algorithm.

re: threads, by default the zram module will use as many threads as you have available processors, you don't need to specify a number of threads unless you want to restrict how many you're using. In an effort to keep configuration simple I never added a num. threads configuration item, I never ran into a situation where I needed it.

You're probably best off not restricting the number of threads zram is using anyway as any program waiting on a page from compressed memory is going to block until that request is fulfilled so you want decompression to be as available as possible, ie: you want it to have a thread on every core so requests can be handled as quickly as possible.