You are not logged in.

#26 2013-12-21 02:33:02

serdotlinecho
Member
Registered: 2013-01-26
Posts: 100

Re: ZSWAP is coming

nbvcxz wrote:

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

#27 2013-12-25 11:22:17

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: ZSWAP is coming

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

#28 2013-12-26 08:45:18

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: ZSWAP is coming

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

#29 2013-12-26 12:04:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: ZSWAP is coming

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

#30 2014-01-10 09:21:59

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: ZSWAP is coming

karol wrote:

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

#31 2014-01-10 16:46:27

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: ZSWAP is coming

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

#32 2014-01-10 16:49:34

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: ZSWAP is coming

Maybe he meant the kernel image.

Offline

#33 2014-01-10 20:19:10

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: ZSWAP is coming

Of course - not recompile but just re-creating kernel image. Thinking right, writing too fast wink . 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

#34 2014-01-10 22:34:29

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: ZSWAP is coming

@nbvcxz

I can confirm that it is working. Thanks!

Offline

#35 2014-01-10 23:24:12

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: ZSWAP is coming

nbvcxz wrote:

Of course - not recompile but just re-creating kernel image. Thinking right, writing too fast wink . 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

#36 2014-04-29 11:24:08

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: ZSWAP is coming

Is zswapram actually needed when using zswap or what is the relation between the two?

Offline

#37 2014-05-04 21:54:21

ooo
Member
Registered: 2013-04-10
Posts: 1,607

Re: ZSWAP is coming

orschiro wrote:

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:

https://en.wikipedia.org/wiki/Zswap#Alternatives wrote:

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

#38 2014-05-04 21:57:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: ZSWAP is coming

orschiro wrote:

Is zswapram actually needed when using zswap or what is the relation between the two?

zramswap, not zswapram :-)

http://www.reddit.com/r/linux/comments/ … wap_using/

Offline

#39 2014-05-05 05:34:53

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: ZSWAP is coming

karol wrote:
orschiro wrote:

Is zswapram actually needed when using zswap or what is the relation between the two?

zramswap, not zswapram :-)

http://www.reddit.com/r/linux/comments/ … wap_using/

Haha thanks guys! smile

Time to finally get rid of ZRAMSWAP and just use zswap.

Offline

#40 2014-06-05 14:01:20

jskier
Member
From: Minnesota, USA
Registered: 2003-07-30
Posts: 374
Website

Re: ZSWAP is coming

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

#41 2014-06-05 16:42:33

ooo
Member
Registered: 2013-04-10
Posts: 1,607

Re: ZSWAP is coming

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

#42 2014-06-05 17:01:03

jskier
Member
From: Minnesota, USA
Registered: 2003-07-30
Posts: 374
Website

Re: ZSWAP is coming

ooo wrote:

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

#43 2014-06-05 18:26:59

ooo
Member
Registered: 2013-04-10
Posts: 1,607

Re: ZSWAP is coming

yes I meant zswap. sorry :)

Offline

#44 2014-06-06 20:09:08

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: ZSWAP is coming

@ 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

#45 2014-06-21 13:41:38

ooo
Member
Registered: 2013-04-10
Posts: 1,607

Re: ZSWAP is coming

nbvcxz wrote:

@ 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

#46 2018-07-13 22:00:45

flower
Member
Registered: 2018-07-07
Posts: 13

Re: ZSWAP is coming

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

#47 2018-07-14 01:46:29

circleface
Member
Registered: 2012-05-26
Posts: 588

Re: ZSWAP is coming

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

#48 2018-07-14 02:02:34

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 25,898
Website

Re: ZSWAP is coming


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB