Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,805,313 Members 50,024 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
vale amicis Old
Thanks Meter 0
Posts: n/a
Cool [INFO][SHARE] What is zRam in Kernel?

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- View Post
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: [ Click to Expand ]
Account currently disabled
Thanks Meter 1
Posts: 6
Join Date: 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 Old
Thanks Meter 0
Posts: n/a
Originally Posted by robowarrior1377 View Post
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 -_-
Andr0id7's Avatar
Senior Member
Thanks Meter 19
Posts: 126
Join Date: Oct 2012
Location: Makati
Thanks for the info

Sent from my GT-N8000 using xda premium
Junior Member
Thanks Meter 3
Posts: 17
Join Date: Jun 2013
Location: Jakarta
Question Zram = extravagant battery

so it makes wasteful battery zram?
excuse me if my English is poorly
Junior Member
Thanks Meter 3
Posts: 14
Join Date: Dec 2012
gj man thanks for info very helpful
Recognized Contributor
Thanks Meter 5,000
Posts: 5,683
Join Date: Jan 2012
Location: New Delhi

Change the first line of the thread.

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

Advanced Search
Display Modes