diff options
Diffstat (limited to 'Documentation/blockdev')
| -rw-r--r-- | Documentation/blockdev/zram.txt | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt index b31ac5e5d4b9..aadfe60391b7 100644 --- a/Documentation/blockdev/zram.txt +++ b/Documentation/blockdev/zram.txt | |||
| @@ -21,7 +21,28 @@ Following shows a typical sequence of steps for using zram. | |||
| 21 | This creates 4 devices: /dev/zram{0,1,2,3} | 21 | This creates 4 devices: /dev/zram{0,1,2,3} |
| 22 | (num_devices parameter is optional. Default: 1) | 22 | (num_devices parameter is optional. Default: 1) |
| 23 | 23 | ||
| 24 | 2) Set Disksize | 24 | 2) Set max number of compression streams |
| 25 | Compression backend may use up to max_comp_streams compression streams, | ||
| 26 | thus allowing up to max_comp_streams concurrent compression operations. | ||
| 27 | By default, compression backend uses single compression stream. | ||
| 28 | |||
| 29 | Examples: | ||
| 30 | #show max compression streams number | ||
| 31 | cat /sys/block/zram0/max_comp_streams | ||
| 32 | |||
| 33 | #set max compression streams number to 3 | ||
| 34 | echo 3 > /sys/block/zram0/max_comp_streams | ||
| 35 | |||
| 36 | Note: | ||
| 37 | In order to enable compression backend's multi stream support max_comp_streams | ||
| 38 | must be initially set to desired concurrency level before ZRAM device | ||
| 39 | initialisation. Once the device initialised as a single stream compression | ||
| 40 | backend (max_comp_streams equals to 0) changing the value of max_comp_streams | ||
| 41 | will not take any effect, because single stream compression backend implemented | ||
| 42 | as a special case and does not support dynamic max_comp_streams. Only multi | ||
| 43 | stream backend supports dynamic max_comp_streams adjustment. | ||
| 44 | |||
| 45 | 3) Set Disksize | ||
| 25 | Set disk size by writing the value to sysfs node 'disksize'. | 46 | Set disk size by writing the value to sysfs node 'disksize'. |
| 26 | The value can be either in bytes or you can use mem suffixes. | 47 | The value can be either in bytes or you can use mem suffixes. |
| 27 | Examples: | 48 | Examples: |
| @@ -38,14 +59,14 @@ There is little point creating a zram of greater than twice the size of memory | |||
| 38 | since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the | 59 | since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the |
| 39 | size of the disk when not in use so a huge zram is wasteful. | 60 | size of the disk when not in use so a huge zram is wasteful. |
| 40 | 61 | ||
| 41 | 3) Activate: | 62 | 4) Activate: |
| 42 | mkswap /dev/zram0 | 63 | mkswap /dev/zram0 |
| 43 | swapon /dev/zram0 | 64 | swapon /dev/zram0 |
| 44 | 65 | ||
| 45 | mkfs.ext4 /dev/zram1 | 66 | mkfs.ext4 /dev/zram1 |
| 46 | mount /dev/zram1 /tmp | 67 | mount /dev/zram1 /tmp |
| 47 | 68 | ||
| 48 | 4) Stats: | 69 | 5) Stats: |
| 49 | Per-device statistics are exported as various nodes under | 70 | Per-device statistics are exported as various nodes under |
| 50 | /sys/block/zram<id>/ | 71 | /sys/block/zram<id>/ |
| 51 | disksize | 72 | disksize |
| @@ -60,11 +81,11 @@ size of the disk when not in use so a huge zram is wasteful. | |||
| 60 | compr_data_size | 81 | compr_data_size |
| 61 | mem_used_total | 82 | mem_used_total |
| 62 | 83 | ||
| 63 | 5) Deactivate: | 84 | 6) Deactivate: |
| 64 | swapoff /dev/zram0 | 85 | swapoff /dev/zram0 |
| 65 | umount /dev/zram1 | 86 | umount /dev/zram1 |
| 66 | 87 | ||
| 67 | 6) Reset: | 88 | 7) Reset: |
| 68 | Write any positive value to 'reset' sysfs node | 89 | Write any positive value to 'reset' sysfs node |
| 69 | echo 1 > /sys/block/zram0/reset | 90 | echo 1 > /sys/block/zram0/reset |
| 70 | echo 1 > /sys/block/zram1/reset | 91 | echo 1 > /sys/block/zram1/reset |
