diff options
Diffstat (limited to 'Documentation/blockdev')
-rw-r--r-- | Documentation/blockdev/zram.txt | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt index 0595c3f56ccf..82c6a41116db 100644 --- a/Documentation/blockdev/zram.txt +++ b/Documentation/blockdev/zram.txt | |||
@@ -74,14 +74,30 @@ There is little point creating a zram of greater than twice the size of memory | |||
74 | since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the | 74 | since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the |
75 | size of the disk when not in use so a huge zram is wasteful. | 75 | size of the disk when not in use so a huge zram is wasteful. |
76 | 76 | ||
77 | 5) Activate: | 77 | 5) Set memory limit: Optional |
78 | Set memory limit by writing the value to sysfs node 'mem_limit'. | ||
79 | The value can be either in bytes or you can use mem suffixes. | ||
80 | In addition, you could change the value in runtime. | ||
81 | Examples: | ||
82 | # limit /dev/zram0 with 50MB memory | ||
83 | echo $((50*1024*1024)) > /sys/block/zram0/mem_limit | ||
84 | |||
85 | # Using mem suffixes | ||
86 | echo 256K > /sys/block/zram0/mem_limit | ||
87 | echo 512M > /sys/block/zram0/mem_limit | ||
88 | echo 1G > /sys/block/zram0/mem_limit | ||
89 | |||
90 | # To disable memory limit | ||
91 | echo 0 > /sys/block/zram0/mem_limit | ||
92 | |||
93 | 6) Activate: | ||
78 | mkswap /dev/zram0 | 94 | mkswap /dev/zram0 |
79 | swapon /dev/zram0 | 95 | swapon /dev/zram0 |
80 | 96 | ||
81 | mkfs.ext4 /dev/zram1 | 97 | mkfs.ext4 /dev/zram1 |
82 | mount /dev/zram1 /tmp | 98 | mount /dev/zram1 /tmp |
83 | 99 | ||
84 | 6) Stats: | 100 | 7) Stats: |
85 | Per-device statistics are exported as various nodes under | 101 | Per-device statistics are exported as various nodes under |
86 | /sys/block/zram<id>/ | 102 | /sys/block/zram<id>/ |
87 | disksize | 103 | disksize |
@@ -96,11 +112,11 @@ size of the disk when not in use so a huge zram is wasteful. | |||
96 | compr_data_size | 112 | compr_data_size |
97 | mem_used_total | 113 | mem_used_total |
98 | 114 | ||
99 | 7) Deactivate: | 115 | 8) Deactivate: |
100 | swapoff /dev/zram0 | 116 | swapoff /dev/zram0 |
101 | umount /dev/zram1 | 117 | umount /dev/zram1 |
102 | 118 | ||
103 | 8) Reset: | 119 | 9) Reset: |
104 | Write any positive value to 'reset' sysfs node | 120 | Write any positive value to 'reset' sysfs node |
105 | echo 1 > /sys/block/zram0/reset | 121 | echo 1 > /sys/block/zram0/reset |
106 | echo 1 > /sys/block/zram1/reset | 122 | echo 1 > /sys/block/zram1/reset |