0

Does CentOS 7 support Zswap? If so, how do I enable it and how to test to see if its working? Is this a good idea for a CentOS server?

Enable attempt:

chmod 777 /sys/module/zswap/parameters/enabled;echo 1 > /sys/module/zswap/parameters/enabled; echo 40 > /sys/module/zswap/parameters/max_pool_percent

Tests I've tried to see if zswap is enabled and working:

grep -R . /sys/kernel/debug/zswap/

Returns:

grep: /sys/kernel/debug/zswap/: No such file or directory

Below returns nothing:

dmesg | grep -i zswap

Parameters do exist:

grep -R . /sys/module/zswap/parameters

Returns:

/sys/module/zswap/parameters/zpool:zbud
/sys/module/zswap/parameters/max_pool_percent:40
/sys/module/zswap/parameters/enabled:Y
/sys/module/zswap/parameters/compressor:lzo

Can pcp-pmda-zswap be used to monitor swap?

My best guess is.. CentOS doesn't officially support zswap, as it should be loaded in dmesg... but I may be wrong.

0

Zswap is a feature introduced in Linux kernel version 3.11. Since CentOS7 ships with kernel version 3.10, so it does not support Zswap out of the box. But you can enable it after replacing the kernel with a newer version, with the commands you provided.

By the way, if you have already update version of kernel, then I suspect that it may because you called chmod on system files, which may be regarded as a security issue.

Try resolve these problems first and then tell me whether you are doing good. :)

references which may come in handy:

# get source, use kernel version v4.11-rc8 as an example
git clone --depth 1 --branch v4.11-rc8 git@github.com:torvalds/linux.git
cd linux
# get default config file
# do nothing in GUI and save, then default config would be saved in .config
make menuconfig
# install build dependencies
sudo yum groupinstall "Development Tools"
sudo yum install ncurses-devel
sudo yum install hmaccalc zlib-devel binutils-devel elfutils-libelf-devel openssl-devel
# new dependency to build kernel v4.x (CentOS 7 uses v3.10.x)
sudo yum install bc
# compile
make all -j
sudo make modules_install
sudo make install
# config grub
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo cat /boot/grub2/grub.cfg
# option depends on order in grub.cfg, 0 is the first one
sudo grub2-set-default 0
# check selection
sudo grub2-editenv list
# restart system with new kernel version
sudo reboot
2
  • git command didn't work for me: 'Permission denied (publickey). fatal: Could not read from remote repository.'
    – Jeff Luyet
    Feb 20 '20 at 23:18
  • please see updated answer for solutions.
    – Fere
    Feb 20 '20 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.