You are not logged in.
Here is short doc: https://www.kernel.org/doc/Documentation/vm/zswap.txt . According to this you can also change compressor type (lzo is default) but I'm going to give a try for lz4 by adding to kernel line zswap.compressor=lz4. But here I have an error that it is not aviable and swithed back to lzo.
Anybody experienced with testing this?
Zswap with lz4.
~ » journalctl -b | grep -i zswap
Dec 20 13:19:19 gnusmas kernel: Kernel command line: BOOT_IMAGE=../vmlinuz-linux-mainline root=/dev/sda1 rw quiet vga=current clocksource=apci_pm zswap.enabled=1 zswap.compressor=lz4 initrd=../initramfs-linux-mainline.img
Dec 20 13:19:19 gnusmas kernel: zswap: loading zswap
Dec 20 13:19:19 gnusmas kernel: zswap: using lz4 compressor
And my kernel config:
~ » gunzip -c /proc/config.gz|grep -i lz4
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_LZ4 is not set
CONFIG_RD_LZ4=y
CONFIG_CRYPTO_LZ4=y
# CONFIG_CRYPTO_LZ4HC is not set
CONFIG_LZ4_COMPRESS=y
CONFIG_LZ4_DECOMPRESS=y
CONFIG_DECOMPRESS_LZ4=y
Offline
Great - working. I wonder if it is possible with pre-compiled versions eg. stock, pf or zen. After Christmas I will try to initramfs MODULES section and see if it works.
Lenovo G50 | LXQT-git | compton | conky
Offline
I wonder why on my system the LZ4 compressor is not available?
➜ ~ dmesg | grep zswap
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=469ca819-9b4d-48d1-b9f9-7377f47ff722 rw pcie_aspm=force acpi_osi=Linux acpi=force acpi_enforce_resources=lax i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 i915.semaphores=1 nmi_watchdog=0 zswap.enabled=1 zswap.compressor=lz4 resume=/dev/mapper/VolGroup00-Swap
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=469ca819-9b4d-48d1-b9f9-7377f47ff722 rw pcie_aspm=force acpi_osi=Linux acpi=force acpi_enforce_resources=lax i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 i915.semaphores=1 nmi_watchdog=0 zswap.enabled=1 zswap.compressor=lz4 resume=/dev/mapper/VolGroup00-Swap
[ 0.563794] zswap: loading zswap
[ 0.565857] zswap: lz4 compressor not available
[ 0.565860] zswap: using lzo compressor
Offline
Maybe serdotlinecho isn't using the stock Arch kernel. I am and
$ zgrep LZ4 /proc/config.gz
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_LZ4 is not set
CONFIG_RD_LZ4=y
CONFIG_CRYPTO_LZ4=m
CONFIG_CRYPTO_LZ4HC=m
CONFIG_LZ4_COMPRESS=m
CONFIG_LZ4HC_COMPRESS=m
CONFIG_LZ4_DECOMPRESS=y
CONFIG_DECOMPRESS_LZ4=y
https://projects.archlinux.org/svntogit … /linux#n67
https://projects.archlinux.org/svntogit … /linux#n66
Offline
Maybe serdotlinecho isn't using the stock Arch kernel.
Sure not. But the solution is so simple that I can't imagine to be so dumb:
1. Add lz4 to MODULES line in /etc/mkinitcpio.conf
2. Recompile Recreate kernel with eg. mkinitcpio -p linux
3. Add zswap.compressor=lz4 to kernel parameters (as in my first post)
4. Reboot
5. Check dmesg | grep zswap . Should be something like:
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux-zen root=UUID=132ccf5d-a68f-409c-b2fd-c4986caddcf3 rw zswap.enabled=1 zswap.compressor=lz4
[ 1.025398] zswap: loading zswap
[ 1.028400] zswap: using lz4 compressor
Last edited by nbvcxz (2014-01-10 20:20:36)
Lenovo G50 | LXQT-git | compton | conky
Offline
I just want to point out in that in step 2, you are not recompiling the kernel. Rather, you are simply building a new initramfs.
Offline
Maybe he meant the kernel image.
Offline
Of course - not recompile but just re-creating kernel image. Thinking right, writing too fast . But the main thing is - everything is working with stock (and other arch compiled) kernels.
Last edited by nbvcxz (2014-01-10 20:19:42)
Lenovo G50 | LXQT-git | compton | conky
Offline
Of course - not recompile but just re-creating kernel image. Thinking right, writing too fast . But the main thing is - everything is working with stock (and other arch compiled) kernels.
Indeed, that is what I figured as well. I just wanted to point it out in case any poor soul in the future came across this thread.
Offline
Is zswapram actually needed when using zswap or what is the relation between the two?
nope, all you need to do to is to add the zswap.enabled=1 boot parameter
the AUR package is for configuring zram which is slightly different from zswap:
One of the alternatives to zswap is zram, which provides a similar but still different "swap compressed pages to RAM" mechanism to the Linux kernel.
The main difference is that zram provides a compressed block device using RAM for storing data, which acts as a regular and separate swap device. Using zram requires additional configuration in userspace (by using mkswap and swapon) so the RAM-based swap device provided by zram is initialized and configured to be used. As a result of its design, zram can provide swap space even if no other swap devices are available, thus making itself more suitable for systems not already providing swap space, such as embedded devices.[11]
In comparison, zswap operates transparently requiring no additional configuration in userspace, and acts as a RAM-based compressed cache for regular swap devices. This provides zswap with an eviction mechanism for less used swapped pages, which zram lacks. Though, as a result of its design, at least one already existing swap device is required in order for zswap to be used.[11]
Offline
Is zswapram actually needed when using zswap or what is the relation between the two?
zramswap, not zswapram :-)
Offline
Does this show anything to entail it is working properly? I don't see anything in swap (/proc/swaps) and
grep . /sys/kernel/debug/zswap/*
shows everything at zero.
I re-generated a new kernel image for lz4 and confirmed boot options are correct (enabled and lz4 options passed).
UPDATE: I should add I don't have zcache being passed, as noted in the sticky post.
Last edited by jskier (2014-06-05 14:05:10)
--
JSkier
Offline
I don't see zswap in /proc/swaps either.
In /sys/kernel/debug/zswap/* nearly everything is zero except stored_pages and pool_pages.
If everything is at zero for you, maybe your RAM just isn't full enough for kernel to start using zswap.
'dmesg | grep -i zswap' should be enough to determine it is working.
Last edited by ooo (2014-06-05 18:27:14)
Offline
I don't see zswap in /proc/swaps either.
'dmesg | grep -i zcache' should be enough to determine it is working.
I assume you mean zswap, not cache? That appears to be good there, I'll try some stress testing as suggested.
Last edited by jskier (2014-06-05 17:01:16)
--
JSkier
Offline
yes I meant zswap. sorry :)
Offline
@ ooo
1 swapon -s (I would like to know if you have any 'physical' swap mounted)
2 If you have a real swap (not in tmpfs or zram) I think it is not used so far so there is nothing to compress
Lenovo G50 | LXQT-git | compton | conky
Offline
@ ooo
1 swapon -s (I would like to know if you have any 'physical' swap mounted)
2 If you have a real swap (not in tmpfs or zram) I think it is not used so far so there is nothing to compress
Sorry I didn't see your post earlier. I didn't have any issues anyway, just tried to help jskier with his question, but here's my swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 4194300 50640 -1
so, I have a 4G swap partition mainly intended for hibernation. If I understand correctly you can't even use zswap without physical swap.
Offline
does anybody know how zswap plays together with hugepages (i have 8gb enabled at boot which is 50% of my total RAM)
max_pool_percent
is it for my whole RAM or just for the RAM left after hugepages initialization?
backing
i'd imagine zswap itself could benefit from hugepages while using them as a backing store
compression
can hugepages be compressed? (i highly doubt it though)
sadly google tells nothing about it.
i had a very strange observation. both times hugepages are enabled.
first without zram i opened a few hundred pictures in gimp. my system swapped 2.6gb ram. ok
with zram: it swapped 1.6gb ram and then killed gimp because of OOM
i dont really understand that behavior. my max_pool_percent is 40
i need hugepages because this machine restarts not very often and starts/stops VMs very frequently. the startup time without hugepages is about 2minutes after some time (i guess because of ram fragmentation).
i want zswap because i use firefox, gimp and others on the host and they have only 8GB ram available (even if the vm's not running, because of hugetables reservation)
Offline
Flower, please do not necrobump old threads. If you still have any questions, please start a new thread to ask the questions so that you own the thread. You can always refer back to this thread if you think it is relevant enough.
Offline
Offline