← Back to team overview

lubuntu-qa team mailing list archive

Re: zRAM broken on Raring?

 

On Sat, 28 Sep 2013 13:04:56 +0200
Nio Wiklund <nio.wiklund@xxxxxxxxx> wrote:

> On 2013-09-28 12:28, Joyce MARKOLL wrote:
> ...
> > 
> > Hi,
> > 
> > I have said what follows in other posts on this list lately, however I will repeat it:
> > 
> > I have used zram in Ubuntu 12 as well as in the present Lubuntu Saucy testing and I
> > don't meet with any freeze : I suspect your kernel(s) want to swap to disk which does
> > cause freezes.
> > 
> > Last year I installed antiX (based on Debian testing) on a very very old machine, HP
> > Omnibus with 192 MB ram and a 800 Mhz celeron processor : I had to configure the
> > swappiness to prevent the kernel from swapping to disk. Once done the zram module (and
> > the associated scripts) did a very good job.
> > 
> > Could you try where your distributions do "freeze" to ask the kernel to not swap to
> > disk? Here is a configuration file:
> > http://meets.free.fr/Downloads/BentoVillageProject/Configurations/System/etc/sysctl.d/50-local.conf
> > 
> > of course, it is meant to be added to /etc/sysctl.d
> > 
> > Else, I configure 20% or 25% max in the initramfs.conf file
> > (under /etc/initramfs-tools) ie: COMPCACHE_SIZE="20%"
> > 
> > (I have explained in another thread that 50%, which is the default in Ubuntu for a
> > reason which is unknown to me, might take too much from the CPU... and the above
> > configuration is what I have been using in several distributions since several years
> > with success, as well as a few dozens of users whom I provided with remixes having
> > this setup).
> > 
> > Let me also add a word about the swap to disk : it is highly desirable to avoid
> > swapping to disk, because it is very slow compared to swap to ram and therefore
> > likely to trigger freezes.
> > 
> > You can find more information about zram here:
> > http://code.google.com/p/compcache/w/list
> > 
> > Regards,
> > Mélodie
> > 
> > 
> 
> Hi Mélodie,
> 
> Do I understand correctly, you say that zRAM and swap to disk cannot
> cooperate, and therefore freeze the system?

Hi Nio,

It is not a matter of cooperation, just see:

* zram : is a compressed space shaped as a block device which lives in RAM and which can
receive data when the RAM is full;

* swap on disk : is a space on hard drive especially formatted to get temporary data when
the RAM is full;

on the other hand, if you often keep an eye on the processes running in the sytem with a
monitoring tool (I like htop a lot for this purpose), you will notice at times that you
have some swap used, whereas the available RAM is still quite large! The kernel swaps to
any swap it finds : zram and or hard drive (with a priority... )

What does this mean? This means that the kernel allows swapping when it is not really
necessary (whether you are using zram or not).

Now, let's consider both options, zram and swap to disk independently one from the other,
which one is faster? zram is faster, no doubt, because it's RAM : just what is not
ordinary is that it is a part of the RAM which is compressed, therefore the real amount
of RAM is larger than the one just provided by the physical RAM devices installed into
the machine.

zram is faster : it's RAM, and RAM is faster than hard drive when it comes to stock and
release data for immediate use.

Let's see now what happens in a computer when having a file which prevents the kernel
from swapping too early:
* The kernel will not swap until almost all available RAM (real RAM) is used;
* The zram module will be used prior to hard drive;

At this point the programs in use start to slow down 

When the programs start to be too slow : don't wait until all is frozen! You still have
the time to close some of the most greedy applications! The monitoring tools can help you
find which ones use lots of RAM and or lots of CPU power.


> That sounds like a bug to
> me, and a bug-fix should solve that problem, because I think some people
> want both.

The bug is the way Ubuntu manages the zram kernel module : compressed swap in RAM is not
opposite to swap to disk, it is the tool which can avoid swapping to disk.

> Otherwise, what happens, when the system is running out of memory? I
> agree, swap to disk is very slow, but what is the alternative if you
> want to hibernate the system instead of shutting down? (I prefer
> shutting down, but I know that some people hibernate their computers.)

If you want to hibernate you need a swap on hard drive at least as large as the available
RAM, and zram is not fit for hibernating purpose. It is not the same use.

> Would it be worth trying to run the system you care about (for example
> Raring or the Saucy current daily build) with zRAM on but swap to disk
> off, and try to provoke it to freeze?

If you run a Live CD with zram in use in a machine which has Windows only and has not
been formatted prior to prepare for a dual boot there are great chances that there is no
swap partition at all in it. And in that kind of machine (with zram configured the right
way) you should be happy to have zram because it will greatly help the gui installer to
perform his task.


Regards,
Mélodie




References