Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

zram strange issue

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
Goshanecr
Apprentice
Apprentice
User avatar
Posts: 158
Joined: Wed Aug 17, 2005 7:58 am
Location: Russia
Contact:
Contact Goshanecr
Website

zram strange issue

  • Quote

Post by Goshanecr » Tue May 22, 2018 7:32 pm

Good day!

I'm setup zram with wiki.
/etc/conf.d/zram-init

Code: Select all

load_on_start="yes"
unload_on_stop="yes"
num_devices="1"

type0="swap"
flag0=
size0="192"
maxs0=1
algo0=lz4
zramctl

Code: Select all

NAME       ALGORITHM DISKSIZE   DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4           192M 191,8M 61,5M 65,4M       1 [SWAP]
cat /proc/swaps

Code: Select all

Filename                                Type            Size    Used    Priority
/dev/sda3                               partition       1048572 183948  -2
/dev/zram0                              partition       196604  196348  16383
And my question is illustrated in zramctl and /proc/swaps output. Why when my zram based swap has 192MB and from zramctl output it compressed size just 61.5MB but it used full and start swapping to disk based swap?!!

I think that for example if I have 100Mb zram based swap with approximately compression ratio 3, then system can fill it to 300MB uncompressed data, but there I have strange statistics.
Please somebody explain that issue to me. Maybe I'm misunderstanding something?
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4694
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Tue May 22, 2018 7:53 pm

If your only usage for zram is swap, then I'd suggest you to move to zswap. It's hazzle-free and, as the name suggests, meant for compressing swap (only).

You can search the kernel documentation for it by running

Code: Select all

find /usr/src/ -type f -name 'zswap.txt'
There isn't Gentoo wiki page for it (yet). But Arch wiki page shoud get you started too.

As for the strange behaviour of your zram... I don't have any idea atm...
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
Goshanecr
Apprentice
Apprentice
User avatar
Posts: 158
Joined: Wed Aug 17, 2005 7:58 am
Location: Russia
Contact:
Contact Goshanecr
Website

  • Quote

Post by Goshanecr » Tue May 22, 2018 8:02 pm

Yes, my usage of zram only for swap, but not for additional swap space, but for something like "Trying to expand low RAM amount by cost of some CPU time".
Now I want to understand why zram based swap show compression from zramctl output, but when size of DATA section equals size of zram it ends up, but COMPR section shows more than 3x lower amount.
Zucca wrote:... then I'd suggest you to move to zswap. It's hazzle-free and, as the name suggests, meant for compressing swap (only).
Zucca thanks for suggestion! When I solve that issue, I'm try to use zswap for disk based swap also and maybe will have zram swap + zswap :)
Top
Goshanecr
Apprentice
Apprentice
User avatar
Posts: 158
Joined: Wed Aug 17, 2005 7:58 am
Location: Russia
Contact:
Contact Goshanecr
Website

  • Quote

Post by Goshanecr » Tue May 22, 2018 8:19 pm

Maybe I understand.... If I think right, amount of ram allocated to zram not piece which cuts from ram, but final size of data (uncompressed) which will fits in it, and amount of ram allocated to it dynamically changes with type of data stored on it, but not more than allocated amount.
So for example if I have 256MB ram and I give 100MB to zram which fills with data with compression ratio 2x, so it consumes 50MB, and I have in that case 256-50+100=306MB virtually RAM.

Am I right? If so, is it possible to set target minimum compression ratio for data stored on zram swap, if not then it sends to backend swap?
Top
Post Reply

4 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic