zswap and lz4 compression December 03, 2017 11:51PM |
Registered: 9 years ago Posts: 226 |
root@debian:~# dmesg | grep zswap [ 8.253409] zswap: loaded using pool lzo/zbudSo zswap is being used, right? Wrong!
root@debian:~# cat /sys/module/zswap/parameters/enabled NIt appears that zswap is always loaded by the kernel, but it's only used if explicitly enabled in the cmdline:
root@debian:~# dmesg | grep -i zswap [ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/sda1 rootdelay=10 rootfstype=ext3 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) zswap.enabled=1 [ 8.376189] zswap: loaded using pool lzo/zbud root@debian:~# cat /sys/module/zswap/parameters/enabled Y
root@debian:~# fw_printenv usb_set_bootargs usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_paramsFor me, the usb_custom_params wasn't being set to anything, so I just used that:
fw_setenv usb_custom_params 'zswap.enabled=1'I could just have easily modified the usb_set_bootargs variable. After making the change and rebooting, you should see the results shown earlier from dmesg and cat /sys/module/zswap/parameters/enabled.
fw_setenv usb_custom_params 'zswap.enabled=1 zswap.compressor=lz4'Add the appropriate modules:
echo lz4 >> /etc/initramfs-tools/modules echo lz4_compress >> /etc/initramfs-tools/modulesHave to update initramfs:
update-initramfs -uOne guide I saw said that at this point all you have to do is reboot, but that's not true for us. You must remake uInitrd. Look at bodhi's great instructions for the specific command for your kernel and hardware. Here's an example (I'm using a fairly old kernel):
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-4.8.3-kirkwood-tld-1 -d initrd.img-4.8.3-kirkwood-tld-1 uInitrdThat should be it! Reboot:
sync sync rebootNow check the dmesg output:
root@debian:/boot# dmesg | grep -i zswap [ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/sda1 rootdelay=10 rootfstype=ext3 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) zswap.enabled=1 zswap.compressor=lz4 [ 8.376189] zswap: loaded using pool lz4/zbud root@debian:/boot# cat /sys/module/zswap/parameters/enabled Y
cat /proc/swaps Filename Type Size Used Priority /media/WD4TB/swapfile file 1048572 4044 -1It shows the swap file I'm using (is it still necessary?), but no mention of zwap.
Re: zswap and lz4 compression December 04, 2017 12:25AM |
Admin Registered: 13 years ago Posts: 18,570 |
Re: zswap and lz4 compression December 04, 2017 12:29AM |
Admin Registered: 13 years ago Posts: 18,570 |
Re: zswap and lz4 compression December 04, 2017 02:35AM |
Admin Registered: 13 years ago Posts: 18,570 |
Quote
bodhi
> I've posted here how to enable and test this, but
> forgot to add it to the wiki :)
>
> But good job laying it all out (in more details
> than I did).
Re: zswap and lz4 compression December 04, 2017 02:40AM |
Registered: 9 years ago Posts: 226 |