zram-config

Leszek Lesner leszek.lesner at web.de
Thu Nov 7 16:40:29 UTC 2013


Am 07.11.2013 17:28, schrieb sd:
> Hi,
>
> Some details about zram-config:
>
> [ppp] 1. I have somehow the impression the system is not fully aware
> about the memory assigned to zram.
> [leszek] To 1. You are wrong. Its a normal swap and all apps which are
> aware of swap are aware of zrams swap.
>
> @leszek - you are right, but that is not what I meant. I meant the
> system is somehow not aware about the RAM amount being in use by zram
> (the system sure knows about zram swap memory).
>
> Below are some tests I did (with a live Lubuntu 13.04 cd in virtual box):
>
> (fresh start)
>
> $sudo swapoff -a
> $sudo service zram-config stop
> $free -h
>      total used free
> Mem: 994M  866M 127M
> Swap:0B   0B 0B
>
> $sudo service zram-config start
> $free -h
>      total used free
> Mem: 994M  870M 123M
> Swap:497M    0B 497M
>
> $cat /proc/swaps
> ...            Size
> /dev/zram0 ... 254508
> /dev/zram0 ... 254508
>
> So ~ 250M per each zram swap.
>
> Sure the system is aware of the zram swap, free command shows it -
> this is obvious to me.
> The system is, however, somehow not aware of the RAM amount zram is
> using, atm it looks like it is using like 0B - may be zram allocates
> the memory dynamically as needed (and the given amount is just a max
> limit)?
>
> (install memtester)

I am not sure what memtester does and how it works exactly.

>
> $sudo memtester 512M
>
> works ok
>
> free -h (on new terminal tab) shows 80M free, no swap used
>
> stop memterster (Ctrl+C)
>
> $sudo memtester 1024M
>
> want 1024, got 1024 trying mlock ...
>
> System freezes, no chance to recover. You have to power the machine down.

Does this also happen when you start applications and got to 1024 MB RAM
usage ?

>
> (Reset VM with live CD) and next test:
>
> $sudo swapoff -a
> $sudo service zram-config stop
> $free -h
>      total used free
> Mem: 994M  734M 259M
> Swap:0B    0B 0B
>
> $sudo memtester 1024M
> want 1024M, got 604M trying mlock ...
>
> The live CD shows next the lightdm login prompt here, not perfect, but
> much better than the freeze with zram active.
> The system behaves better in this case on low memory. At least you
> have a chance to do a propert shutdown, start a new desktop session, etc.
>
> After restart of VM with live CD next test:
>
> $sudo swapoff -a
> $sudo service zram-config stop
> $sudo service zram-config start
> $free -h
>      total used free
> Mem: 994M  864M 129M
> Swap:497M    0B 497M
>
> $sudo memtester 512M
> want 512, got 512 locked
>
> $free -h (new terninal tab, while memtester command above active)
>      total used free
> Mem: 994M  929M 64M
> Swap:497M    4K 497M
>
> $top
> memtester RES 512m VIRT 516m %MEM 51.5%
>
> Now in a new terminal tab:
>
> $sudo memtester 128M
> want 128MB got 128 MB locked
>
> $free -h
> similar to above 4M swap used
>
> $sudo memtester 512M (new terminal tab)
> Same system freeze as before.
>
> The behavior what happens in a Lubuntu box when there is no more free
> memory seems to be deterministic:
>
> -With zram swap active - it just freezes - no warning, no chance, you
> have to reset power of the system.

This should not be the case (at least when there is no other bug in the
kernel)

> -Without zram active - it kills the desktop user session, shows lighdm
> login - much better.
>

The interesting question would be if someone could verify this with
normal applications instead of memtester.



More information about the Lubuntu-users mailing list