Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Zram multistreaming or "multi-deviceing"?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
gol70
n00b
n00b


Joined: 15 Oct 2014
Posts: 8

PostPosted: Mon Aug 05, 2019 2:26 pm    Post subject: Zram multistreaming or "multi-deviceing"? Reply with quote

First of all sorry if this is not proper section of the forum to post this question.
I'm rookie in linux so maybe I missed something but the informations concerning zram configuration are inconsistent for me.

1. gentoo wiki https://wiki.gentoo.org/wiki/Zram showing the example where the zram swap configuration is based on a few zram devices (one dev per cpu core)

2. the tool (sys-block/zram-init) recommended in the same wiki topic makes things the same way (one dev per core)

Sounds logically - one communication stream with zram device is handled by one core
but according to:

3 https://www.kernel.org/doc/Documentation/blockdev/zram.txt
ZRAM always allocate multiple compression streams - one per online CPUs - thus allowing several concurrent compression operations. The number of allocated compression streams goes down when some of the CPUs become offline. There is no single-compression-stream mode anymore

4 https://lore.kernel.org/patchwork/patch/675423/
Remove the internal part of max_comp_streams interface, since we switched to per-cpu streams

looks like multistreaming is part of the single zram dev functionality and multi device hack is not valid since few years.

5. On the ArchLinux wiki
https://wiki.archlinux.org/index.php/Improving_performance#Zram_or_zswap
and especially in the ArchLinux zramswap package
https://aur.archlinux.org/cgit/aur.git/tree/zramctrl?h=zramswap
it seems that they assuming the internal zram multistreaming and not implement the zram dev multiplication. (btw the description of this package on the wiki not corresponding with the package body because package creates one zram device)

6.Additionally zram dev multiplication is not the performance booster :
https://lkml.org/lkml/2016/3/30/124

The question is:
Do we need multiple zram devices hack if multistreaming is built inside the single zram device?

_________________
best regards
Gregory


Last edited by gol70 on Thu Aug 15, 2019 10:42 pm; edited 7 times in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5879

PostPosted: Mon Aug 05, 2019 3:57 pm    Post subject: Reply with quote

The answer: no — the streams option has made the multi-device hack obsolete. The Gentoo wiki page was written for kernel 3.x, and probably needs a total rewrite. That zram-init script does too.
The only technical reason you'd want to use more than one zram device is to tune it for memory-hotplug or NUMA systems, but it looks like zram's not even NUMA-aware anyway.

I use this in /etc/local.d/ to set up zram:
Code:
#!/bin/sh -eu
half_mem=$(awk '/^MemTotal:/ { print int($2 / 2) "KiB"; exit }' /proc/meminfo)
zram_dev=$(/sbin/zramctl --find --algorithm zstd --size $half_mem --streams $(nproc))
# using a fixed uuid avoids an early-boot uninitialised /dev/urandom read warning in dmesg
/sbin/mkswap --uuid cceea5ca-5820-418b-ac0e-dd81372a47f1 $zram_dev
/sbin/swapon --discard --priority=2 $zram_dev
Back to top
View user's profile Send private message
gol70
n00b
n00b


Joined: 15 Oct 2014
Posts: 8

PostPosted: Mon Aug 05, 2019 6:29 pm    Post subject: Reply with quote

Thanks Ant P.!
This is what I expected.
For the newbies the gentoo wiki is the Oracle. Its a pity that parts of this wiki are so outdated.
_________________
best regards
Gregory
Back to top
View user's profile Send private message
alphaomega325
n00b
n00b


Joined: 02 Jan 2017
Posts: 25

PostPosted: Tue Aug 06, 2019 4:38 pm    Post subject: Reply with quote

gol70 wrote:
Thanks Ant P.!
This is what I expected.
For the newbies the gentoo wiki is the Oracle. Its a pity that parts of this wiki are so outdated.


Well I heard that there used to be a much better wiki, but it privately owned and operated and the owner of said wiki didn't make any backups. And so he lost the wiki and we have the outdated wiki we have today.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum