aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2014-01-30 18:45:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-30 19:56:55 -0500
commitcd67e10ac6997c6d1e1504e3c111b693bfdbc148 (patch)
treea37521eff62f7e7e86ab94be44f02aca4c6a0abb /drivers
parentbcf1647d0899666f0fb90d176abf63bae22abb7c (diff)
zram: promote zram from staging
Zram has lived in staging for a LONG LONG time and have been fixed/improved by many contributors so code is clean and stable now. Of course, there are lots of product using zram in real practice. The major TV companys have used zram as swap since two years ago and recently our production team released android smart phone with zram which is used as swap, too and recently Android Kitkat start to use zram for small memory smart phone. And there was a report Google released their ChromeOS with zram, too and cyanogenmod have been used zram long time ago. And I heard some disto have used zram block device for tmpfs. In addition, I saw many report from many other peoples. For example, Lubuntu start to use it. The benefit of zram is very clear. With my experience, one of the benefit was to remove jitter of video application with backgroud memory pressure. It would be effect of efficient memory usage by compression but more issue is whether swap is there or not in the system. Recent mobile platforms have used JAVA so there are many anonymous pages. But embedded system normally are reluctant to use eMMC or SDCard as swap because there is wear-leveling and latency issues so if we do not use swap, it means we can't reclaim anoymous pages and at last, we could encounter OOM kill. :( Although we have real storage as swap, it was a problem, too. Because it sometime ends up making system very unresponsible caused by slow swap storage performance. Quote from Luigi on Google "Since Chrome OS was mentioned: the main reason why we don't use swap to a disk (rotating or SSD) is because it doesn't degrade gracefully and leads to a bad interactive experience. Generally we prefer to manage RAM at a higher level, by transparently killing and restarting processes. But we noticed that zram is fast enough to be competitive with the latter, and it lets us make more efficient use of the available RAM. " and he announced. http://www.spinics.net/lists/linux-mm/msg57717.html Other uses case is to use zram for block device. Zram is block device so anyone can format the block device and mount on it so some guys on the internet start zram as /var/tmp. http://forums.gentoo.org/viewtopic-t-838198-start-0.html Let's promote zram and enhance/maintain it instead of removing. Signed-off-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Pekka Enberg <penberg@kernel.org> Cc: Bob Liu <bob.liu@oracle.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Hugh Dickins <hughd@google.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Luigi Semenzato <semenzato@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Rik van Riel <riel@redhat.com> Cc: Seth Jennings <sjenning@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/Kconfig2
-rw-r--r--drivers/block/Makefile1
-rw-r--r--drivers/block/zram/Kconfig (renamed from drivers/staging/zram/Kconfig)0
-rw-r--r--drivers/block/zram/Makefile (renamed from drivers/staging/zram/Makefile)0
-rw-r--r--drivers/block/zram/zram_drv.c (renamed from drivers/staging/zram/zram_drv.c)0
-rw-r--r--drivers/block/zram/zram_drv.h (renamed from drivers/staging/zram/zram_drv.h)0
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/zram/zram.txt77
9 files changed, 3 insertions, 80 deletions
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 9ffa90c6201c..014a1cfc41c5 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -108,6 +108,8 @@ source "drivers/block/paride/Kconfig"
108 108
109source "drivers/block/mtip32xx/Kconfig" 109source "drivers/block/mtip32xx/Kconfig"
110 110
111source "drivers/block/zram/Kconfig"
112
111config BLK_CPQ_DA 113config BLK_CPQ_DA
112 tristate "Compaq SMART2 support" 114 tristate "Compaq SMART2 support"
113 depends on PCI && VIRT_TO_BUS && 0 115 depends on PCI && VIRT_TO_BUS && 0
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index 816d979c3266..02b688d1438d 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BLK_DEV_PCIESSD_MTIP32XX) += mtip32xx/
42 42
43obj-$(CONFIG_BLK_DEV_RSXX) += rsxx/ 43obj-$(CONFIG_BLK_DEV_RSXX) += rsxx/
44obj-$(CONFIG_BLK_DEV_NULL_BLK) += null_blk.o 44obj-$(CONFIG_BLK_DEV_NULL_BLK) += null_blk.o
45obj-$(CONFIG_ZRAM) += zram/
45 46
46nvme-y := nvme-core.o nvme-scsi.o 47nvme-y := nvme-core.o nvme-scsi.o
47skd-y := skd_main.o 48skd-y := skd_main.o
diff --git a/drivers/staging/zram/Kconfig b/drivers/block/zram/Kconfig
index 983314c41349..983314c41349 100644
--- a/drivers/staging/zram/Kconfig
+++ b/drivers/block/zram/Kconfig
diff --git a/drivers/staging/zram/Makefile b/drivers/block/zram/Makefile
index cb0f9ced6a93..cb0f9ced6a93 100644
--- a/drivers/staging/zram/Makefile
+++ b/drivers/block/zram/Makefile
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 108f2733106d..108f2733106d 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
diff --git a/drivers/staging/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index d8f6596513c3..d8f6596513c3 100644
--- a/drivers/staging/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 120d2fa9e531..040a51525b42 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -76,8 +76,6 @@ source "drivers/staging/sep/Kconfig"
76 76
77source "drivers/staging/iio/Kconfig" 77source "drivers/staging/iio/Kconfig"
78 78
79source "drivers/staging/zram/Kconfig"
80
81source "drivers/staging/wlags49_h2/Kconfig" 79source "drivers/staging/wlags49_h2/Kconfig"
82 80
83source "drivers/staging/wlags49_h25/Kconfig" 81source "drivers/staging/wlags49_h25/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index cb19d0afa0da..dea056bf7ff2 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_VT6656) += vt6656/
32obj-$(CONFIG_VME_BUS) += vme/ 32obj-$(CONFIG_VME_BUS) += vme/
33obj-$(CONFIG_DX_SEP) += sep/ 33obj-$(CONFIG_DX_SEP) += sep/
34obj-$(CONFIG_IIO) += iio/ 34obj-$(CONFIG_IIO) += iio/
35obj-$(CONFIG_ZRAM) += zram/
36obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ 35obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
37obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ 36obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
38obj-$(CONFIG_FB_SM7XX) += sm7xxfb/ 37obj-$(CONFIG_FB_SM7XX) += sm7xxfb/
diff --git a/drivers/staging/zram/zram.txt b/drivers/staging/zram/zram.txt
deleted file mode 100644
index 765d790ae831..000000000000
--- a/drivers/staging/zram/zram.txt
+++ /dev/null
@@ -1,77 +0,0 @@
1zram: Compressed RAM based block devices
2----------------------------------------
3
4Project home: http://compcache.googlecode.com/
5
6* Introduction
7
8The zram module creates RAM based block devices named /dev/zram<id>
9(<id> = 0, 1, ...). Pages written to these disks are compressed and stored
10in memory itself. These disks allow very fast I/O and compression provides
11good amounts of memory savings. Some of the usecases include /tmp storage,
12use as swap disks, various caches under /var and maybe many more :)
13
14Statistics for individual zram devices are exported through sysfs nodes at
15/sys/block/zram<id>/
16
17* Usage
18
19Following shows a typical sequence of steps for using zram.
20
211) Load Module:
22 modprobe zram num_devices=4
23 This creates 4 devices: /dev/zram{0,1,2,3}
24 (num_devices parameter is optional. Default: 1)
25
262) Set Disksize
27 Set disk size by writing the value to sysfs node 'disksize'.
28 The value can be either in bytes or you can use mem suffixes.
29 Examples:
30 # Initialize /dev/zram0 with 50MB disksize
31 echo $((50*1024*1024)) > /sys/block/zram0/disksize
32
33 # Using mem suffixes
34 echo 256K > /sys/block/zram0/disksize
35 echo 512M > /sys/block/zram0/disksize
36 echo 1G > /sys/block/zram0/disksize
37
383) Activate:
39 mkswap /dev/zram0
40 swapon /dev/zram0
41
42 mkfs.ext4 /dev/zram1
43 mount /dev/zram1 /tmp
44
454) Stats:
46 Per-device statistics are exported as various nodes under
47 /sys/block/zram<id>/
48 disksize
49 num_reads
50 num_writes
51 invalid_io
52 notify_free
53 discard
54 zero_pages
55 orig_data_size
56 compr_data_size
57 mem_used_total
58
595) Deactivate:
60 swapoff /dev/zram0
61 umount /dev/zram1
62
636) Reset:
64 Write any positive value to 'reset' sysfs node
65 echo 1 > /sys/block/zram0/reset
66 echo 1 > /sys/block/zram1/reset
67
68 This frees all the memory allocated for the given device and
69 resets the disksize to zero. You must set the disksize again
70 before reusing the device.
71
72Please report any problems at:
73 - Mailing list: linux-mm-cc at laptop dot org
74 - Issue tracker: http://code.google.com/p/compcache/issues/list
75
76Nitin Gupta
77ngupta@vflare.org