Question about zswap parameters

Hello, Garuda enables zram and therefore disables zswap by defaut. Just a question about the following output:

sudo grep -R . /sys/module/zswap/parameters | grep -in enabled 
1:/sys/module/zswap/parameters/enabled:N
2:/sys/module/zswap/parameters/shrinker_enabled:Y

What does “shrinker_enabled” mean? Should it be disabled? Thanks.

Hi minouboy,

On Arch-based Linux systems, the term “Zswap shrinker enabled” typically refers to a feature related to Zswap, which is a compressed cache for swap pages. Zswap is a kernel feature that aims to improve the performance of swap operations by compressing pages before they are written to the swap device. This can help reduce the amount of I/O that occurs when the system runs out of RAM, potentially improving responsiveness.

Its not wrong to leave it on it helps not to oldering the Ssd :wink:

1 Like

shrinker_enabled allows the zswap pool to dynamically shrink itself in response to memory pressure (to free up some RAM space for other things).

zswap — The Linux Kernel documentation

When there is a sizable amount of cold memory residing in the zswap pool, it can be advantageous to proactively write these cold pages to swap and reclaim the memory for other use cases. By default, the zswap shrinker is disabled. User can enable it as follows:

echo Y > /sys/module/zswap/parameters/shrinker_enabled

This can be enabled at the boot time if CONFIG_ZSWAP_SHRINKER_DEFAULT_ON is selected.

Cool feature! But when zswap is disabled it doesn’t actually do anything, so in our case it makes no difference if it is enabled or not (because we are using zram instead of zswap).

The reason the shrinker is enabled in the first place is the kernel you are using is compiled with the configuration parameter mentioned in the doc linked above.

❯ zcat /proc/config.gz | grep CONFIG_ZSWAP_SHRINKER_DEFAULT_ON
CONFIG_ZSWAP_SHRINKER_DEFAULT_ON=y

I hope that helps, welcome back @minouboy. :wave:

5 Likes

Thanks a lot for these anwsers.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.