Unofficial CM12.1 Available for Moto E 2014

While Motorola is yet to release a final 5.0.2 build for the Moto E 2014, XDA Senior … more

Pinsy Brings Social Sketching To Your Watch & Phone

Did you watch Apple’s VP draw on his wrist during the Apple Watch announcement … more

CyanogenMod 12.1 for Samsung Galaxy S5

Android 5.1 is slowly putting its mark in the custom ROM world. CyanogenMod 12.1 is available to … more

Nexus Player 5.1 LMY47D Rooted

We recently featured the Nexus Player, Google’s second attempt at a digital media … more
Post Reply Subscribe to Thread Email Thread

[INFO][SHARE] What is zRam in Kernel?

vale amicis
12th June 2013, 08:57 AM   |  #1  
Thanks Meter: 0
n/a posts
Some budding devs like me and some others have asked this question and got this answer!

Firstly I want to thanks all who supported me!

My Parents for buying me an Android Device and Supporting
-CALIBAN666- for his thread
franciscofranco for his definition on zRam
Sniper Killer

And all those whom I have forgotten to mention!


Originally posted by Wikipedia

Q: What is zRam?
A: zRam is a module of the Linux kernel, previously called "compcache". zRam increases performance by avoiding paging on disk and instead uses a compressed block device in RAM in which paging takes place until it is necessary to use the swap space on the hard disk drive. Since using RAM is faster than using disks, zRam allows Linux to make more use of RAM when swapping/paging is required, especially on older computers with less RAM installed.

Google has also said to enable zRam as default for Chrome OS Devices!


Originally posted by franciscofranco

The zram module creates RAM based block devices: /dev/ramX (X = 0, 1, ...).
Pages written to these disks are compressed and stored in memory itself.
These disks allow very fast I/O and compression provides good amounts of
memory savings.

Basically is for storing swapped pages into compressed memory ram.

Originally Posted by -CALIBAN666-

I think its better to Post this here,when its not better,than sorry!!!
Once a brief statement for those who are not traveling so long in the Android scene:
ZRAM = ramzswap = Compcache

In order to explain more precisely ZRAM first need other terms are more clearly defined:
Swap can be compared with the swap file on Windows. If the memory (RAM) to complete the PC the data that are being used not actively outsource (eg background applications) so as to re-evacuate RAM free. To this data is written to a hard disk. If required, this data is then read back from there easily. Even the fastest SSD is slower than the RAM. On Android, there is no swap!

In ZRAM unnecessary storage resources are compressed and then moved to a reserved area in the fixed RAM (ZRAM). So a kind of swap in memory.
This Ram is more free because the data then only about 1/4 of the former storage requirements have. However, the CPU has to work in more because they compress the data has (or unpack again when they are needed). The advantage clearly lies in the speed. Since the swap partition in RAM is much faster than this is a swap partition on a hard drive.

In itself a great thing. But Android does not have a swap partition, and therefore brings Android ZRAM under no performance gain as would be the case with a normal PC.

In normal PC would look like this:
Swap = swap file (on disk) -> Slow
ZRAM (swap in RAM) -> Faster than swap
RAM -> Quick

With Android, there is no swap partition, and therefore brings ZRAM also no performance boost.
The only thing that brings ZRAM is "more" RAM. Compressed by the "enlarged" so to speak of the available memory. That's on devices with little RAM (<256MB) also pretty useful. The S2 has 1GB but the rich, and more than. There must not be artificially pushed up to 1.5 GB.

After you activate the ZRAM also has 2 disadvantages. The encoding and decoding using CPU time, which in turn has higher power consumption.

Roughly one can say (For devices with more than 512MB RAM):
Without ZRAM: + CPU Performance | + Battery | RAM
With ZRAM: CPU Performance |-Battery | + RAM

For devices with too little RAM so it makes perfect sense. But who shoots the S2 already be fully complete RAM and then still need more?

Check whether you can ZRAM runs in the terminal with
free or cat / proc / meminfo

I hope it helps to understand zRam!!!!

So basically zRam module in kernel increases and optimizes performance!

I didn't write all this information, I just compiled it together in one thread for ease
The Following User Says Thank You to For This Useful Post: [ View ]
12th June 2013, 09:16 AM   |  #2  
Account currently disabled
Thanks Meter: 1
6 posts
Join Date:Joined: Jun 2013
But making it work is an headache.. you have to add LZO(Lempel–Ziv–Oberhumer) compression through menuconfig and then run zRam scripts through init.d and what not..
vale amicis
12th June 2013, 09:17 AM   |  #3  
Thanks Meter: 0
n/a posts
Originally Posted by robowarrior1377

But making it work is an headache.. you have to add LZO(Lempel–Ziv–Oberhumer) compression through menuconfig and then run zRam scripts through init.d and what not..

This thread is a information share thread

It is not a thread in how to enable it in your kernel -_-
12th June 2013, 09:23 AM   |  #4  
Andr0id7's Avatar
Senior Member
Flag Makati
Thanks Meter: 19
126 posts
Join Date:Joined: Oct 2012
Thanks for the info

Sent from my GT-N8000 using xda premium
12th June 2013, 11:26 AM   |  #5  
Junior Member
Flag Jakarta
Thanks Meter: 6
26 posts
Join Date:Joined: Jun 2013
Donate to Me
Question Zram = extravagant battery
so it makes wasteful battery zram?
excuse me if my English is poorly
14th June 2013, 09:54 PM   |  #6  
Junior Member
Thanks Meter: 3
16 posts
Join Date:Joined: Dec 2012
gj man thanks for info very helpful
18th June 2013, 12:43 PM   |  #7  
Recognized Developer / Recognized Contributor
Flag New Delhi
Thanks Meter: 5,121
5,834 posts
Join Date:Joined: Jan 2012
Donate to Me
Change the first line of the thread.

Post Reply Subscribe to Thread

info, kernel, kernel info, what is zram?, zram
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes