aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/blockdev/zram.txt
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2014-04-07 18:38:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:36:01 -0400
commite46b8a030d76d3c94156c545c3f4c3676d813435 (patch)
tree9629389f89d3086a6428ec6a8e47bc59ddfcf3ec /Documentation/blockdev/zram.txt
parentfe8eb122c82b2049c460fc6df6e8583a2f935cff (diff)
zram: make compression algorithm selection possible
Add and document `comp_algorithm' device attribute. This attribute allows to show supported compression and currently selected compression algorithms: cat /sys/block/zram0/comp_algorithm [lzo] lz4 and change selected compression algorithm: echo lzo > /sys/block/zram0/comp_algorithm Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/blockdev/zram.txt')
-rw-r--r--Documentation/blockdev/zram.txt24
1 files changed, 19 insertions, 5 deletions
diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt
index aadfe60391b7..2604ffed51db 100644
--- a/Documentation/blockdev/zram.txt
+++ b/Documentation/blockdev/zram.txt
@@ -42,7 +42,21 @@ will not take any effect, because single stream compression backend implemented
42as a special case and does not support dynamic max_comp_streams. Only multi 42as a special case and does not support dynamic max_comp_streams. Only multi
43stream backend supports dynamic max_comp_streams adjustment. 43stream backend supports dynamic max_comp_streams adjustment.
44 44
453) Set Disksize 453) Select compression algorithm
46 Using comp_algorithm device attribute one can see available and
47 currently selected (shown in square brackets) compression algortithms,
48 change selected compression algorithm (once the device is initialised
49 there is no way to change compression algorithm).
50
51 Examples:
52 #show supported compression algorithms
53 cat /sys/block/zram0/comp_algorithm
54 lzo [lz4]
55
56 #select lzo compression algorithm
57 echo lzo > /sys/block/zram0/comp_algorithm
58
594) Set Disksize
46 Set disk size by writing the value to sysfs node 'disksize'. 60 Set disk size by writing the value to sysfs node 'disksize'.
47 The value can be either in bytes or you can use mem suffixes. 61 The value can be either in bytes or you can use mem suffixes.
48 Examples: 62 Examples:
@@ -59,14 +73,14 @@ There is little point creating a zram of greater than twice the size of memory
59since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the 73since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the
60size of the disk when not in use so a huge zram is wasteful. 74size of the disk when not in use so a huge zram is wasteful.
61 75
624) Activate: 765) Activate:
63 mkswap /dev/zram0 77 mkswap /dev/zram0
64 swapon /dev/zram0 78 swapon /dev/zram0
65 79
66 mkfs.ext4 /dev/zram1 80 mkfs.ext4 /dev/zram1
67 mount /dev/zram1 /tmp 81 mount /dev/zram1 /tmp
68 82
695) Stats: 836) Stats:
70 Per-device statistics are exported as various nodes under 84 Per-device statistics are exported as various nodes under
71 /sys/block/zram<id>/ 85 /sys/block/zram<id>/
72 disksize 86 disksize
@@ -81,11 +95,11 @@ size of the disk when not in use so a huge zram is wasteful.
81 compr_data_size 95 compr_data_size
82 mem_used_total 96 mem_used_total
83 97
846) Deactivate: 987) Deactivate:
85 swapoff /dev/zram0 99 swapoff /dev/zram0
86 umount /dev/zram1 100 umount /dev/zram1
87 101
887) Reset: 1028) Reset:
89 Write any positive value to 'reset' sysfs node 103 Write any positive value to 'reset' sysfs node
90 echo 1 > /sys/block/zram0/reset 104 echo 1 > /sys/block/zram0/reset
91 echo 1 > /sys/block/zram1/reset 105 echo 1 > /sys/block/zram1/reset