blob: 520edc1bea73c0c048b6da52eb0edd24ea360080 [file] [log] [blame]
Nitin Gupta00ac9ba2010-06-01 13:31:26 +05301zram: Compressed RAM based block devices
2----------------------------------------
Nitin Gupta47f9afb2009-09-22 10:26:54 +05303
4Project home: http://compcache.googlecode.com/
5
6* Introduction
7
Nitin Gupta00ac9ba2010-06-01 13:31:26 +05308The zram module creates RAM based block devices: /dev/ramX (X = 0, 1, ...).
9Pages written to these disks are compressed and stored in memory itself.
10These disks allow very fast I/O and compression provides good amounts of
11memory savings.
Nitin Gupta47f9afb2009-09-22 10:26:54 +053012
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053013See project home for use cases, performance numbers and a lot more.
14
15Individual zram devices are configured and initialized using zramconfig
16userspace utility as shown in examples below. See zramconfig man page for
17more details.
Nitin Gupta47f9afb2009-09-22 10:26:54 +053018
19* Usage
20
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053021Following shows a typical sequence of steps for using zram.
Nitin Gupta47f9afb2009-09-22 10:26:54 +053022
231) Load Modules:
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053024 modprobe zram num_devices=4
25 This creates 4 (uninitialized) devices: /dev/zram{0,1,2,3}
Nitin Gupta47f9afb2009-09-22 10:26:54 +053026 (num_devices parameter is optional. Default: 1)
27
282) Initialize:
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053029 Use zramconfig utility to configure and initialize individual
30 zram devices. For example:
31 zramconfig /dev/zram0 --init # uses default value of disksize_kb
32 zramconfig /dev/zram1 --disksize_kb=102400 # 100MB /dev/zram1
Nitin Gupta47f9afb2009-09-22 10:26:54 +053033
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053034 *See zramconfig man page for more details and examples*
Nitin Gupta47f9afb2009-09-22 10:26:54 +053035
363) Activate:
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053037 mkswap /dev/zram0
38 swapon /dev/zram0
39
40 mkfs.ext4 /dev/zram1
41 mount /dev/zram1 /tmp
Nitin Gupta47f9afb2009-09-22 10:26:54 +053042
434) Stats:
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053044 zramconfig /dev/zram0 --stats
45 zramconfig /dev/zram1 --stats
Nitin Gupta47f9afb2009-09-22 10:26:54 +053046
475) Deactivate:
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053048 swapoff /dev/zram0
49 umount /dev/zram1
Nitin Gupta47f9afb2009-09-22 10:26:54 +053050
516) Reset:
Nitin Gupta00ac9ba2010-06-01 13:31:26 +053052 zramconfig /dev/zram0 --reset
53 zramconfig /dev/zram1 --reset
54 (This frees memory allocated for the given device).
Nitin Gupta47f9afb2009-09-22 10:26:54 +053055
56
57Please report any problems at:
58 - Mailing list: linux-mm-cc at laptop dot org
59 - Issue tracker: http://code.google.com/p/compcache/issues/list
60
61Nitin Gupta
62ngupta@vflare.org