Skip to content

Commit 69a30a8

Browse files
sergey-senozhatskytorvalds
authored andcommitted
zram: cosmetic: cleanup documentation
zram documentation is a mix of different styles: spaces, tabs, tabs + spaces, etc. Clean it up. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Sergey Senozhatsky <[email protected]> Acked-by: Minchan Kim <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 415403b commit 69a30a8

File tree

1 file changed

+45
-46
lines changed

1 file changed

+45
-46
lines changed

Documentation/blockdev/zram.txt

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -59,73 +59,72 @@ num_devices parameter is optional and tells zram how many devices should be
5959
pre-created. Default: 1.
6060

6161
2) Set max number of compression streams
62-
Regardless the value passed to this attribute, ZRAM will always
63-
allocate multiple compression streams - one per online CPUs - thus
64-
allowing several concurrent compression operations. The number of
65-
allocated compression streams goes down when some of the CPUs
66-
become offline. There is no single-compression-stream mode anymore,
67-
unless you are running a UP system or has only 1 CPU online.
68-
69-
To find out how many streams are currently available:
62+
Regardless the value passed to this attribute, ZRAM will always
63+
allocate multiple compression streams - one per online CPUs - thus
64+
allowing several concurrent compression operations. The number of
65+
allocated compression streams goes down when some of the CPUs
66+
become offline. There is no single-compression-stream mode anymore,
67+
unless you are running a UP system or has only 1 CPU online.
68+
69+
To find out how many streams are currently available:
7070
cat /sys/block/zram0/max_comp_streams
7171

7272
3) Select compression algorithm
73-
Using comp_algorithm device attribute one can see available and
74-
currently selected (shown in square brackets) compression algorithms,
75-
change selected compression algorithm (once the device is initialised
76-
there is no way to change compression algorithm).
73+
Using comp_algorithm device attribute one can see available and
74+
currently selected (shown in square brackets) compression algorithms,
75+
change selected compression algorithm (once the device is initialised
76+
there is no way to change compression algorithm).
7777

78-
Examples:
78+
Examples:
7979
#show supported compression algorithms
8080
cat /sys/block/zram0/comp_algorithm
8181
lzo [lz4]
8282

8383
#select lzo compression algorithm
8484
echo lzo > /sys/block/zram0/comp_algorithm
8585

86-
For the time being, the `comp_algorithm' content does not necessarily
87-
show every compression algorithm supported by the kernel. We keep this
88-
list primarily to simplify device configuration and one can configure
89-
a new device with a compression algorithm that is not listed in
90-
`comp_algorithm'. The thing is that, internally, ZRAM uses Crypto API
91-
and, if some of the algorithms were built as modules, it's impossible
92-
to list all of them using, for instance, /proc/crypto or any other
93-
method. This, however, has an advantage of permitting the usage of
94-
custom crypto compression modules (implementing S/W or H/W
95-
compression).
86+
For the time being, the `comp_algorithm' content does not necessarily
87+
show every compression algorithm supported by the kernel. We keep this
88+
list primarily to simplify device configuration and one can configure
89+
a new device with a compression algorithm that is not listed in
90+
`comp_algorithm'. The thing is that, internally, ZRAM uses Crypto API
91+
and, if some of the algorithms were built as modules, it's impossible
92+
to list all of them using, for instance, /proc/crypto or any other
93+
method. This, however, has an advantage of permitting the usage of
94+
custom crypto compression modules (implementing S/W or H/W compression).
9695

9796
4) Set Disksize
98-
Set disk size by writing the value to sysfs node 'disksize'.
99-
The value can be either in bytes or you can use mem suffixes.
100-
Examples:
101-
# Initialize /dev/zram0 with 50MB disksize
102-
echo $((50*1024*1024)) > /sys/block/zram0/disksize
97+
Set disk size by writing the value to sysfs node 'disksize'.
98+
The value can be either in bytes or you can use mem suffixes.
99+
Examples:
100+
# Initialize /dev/zram0 with 50MB disksize
101+
echo $((50*1024*1024)) > /sys/block/zram0/disksize
103102

104-
# Using mem suffixes
105-
echo 256K > /sys/block/zram0/disksize
106-
echo 512M > /sys/block/zram0/disksize
107-
echo 1G > /sys/block/zram0/disksize
103+
# Using mem suffixes
104+
echo 256K > /sys/block/zram0/disksize
105+
echo 512M > /sys/block/zram0/disksize
106+
echo 1G > /sys/block/zram0/disksize
108107

109108
Note:
110109
There is little point creating a zram of greater than twice the size of memory
111110
since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the
112111
size of the disk when not in use so a huge zram is wasteful.
113112

114113
5) Set memory limit: Optional
115-
Set memory limit by writing the value to sysfs node 'mem_limit'.
116-
The value can be either in bytes or you can use mem suffixes.
117-
In addition, you could change the value in runtime.
118-
Examples:
119-
# limit /dev/zram0 with 50MB memory
120-
echo $((50*1024*1024)) > /sys/block/zram0/mem_limit
121-
122-
# Using mem suffixes
123-
echo 256K > /sys/block/zram0/mem_limit
124-
echo 512M > /sys/block/zram0/mem_limit
125-
echo 1G > /sys/block/zram0/mem_limit
126-
127-
# To disable memory limit
128-
echo 0 > /sys/block/zram0/mem_limit
114+
Set memory limit by writing the value to sysfs node 'mem_limit'.
115+
The value can be either in bytes or you can use mem suffixes.
116+
In addition, you could change the value in runtime.
117+
Examples:
118+
# limit /dev/zram0 with 50MB memory
119+
echo $((50*1024*1024)) > /sys/block/zram0/mem_limit
120+
121+
# Using mem suffixes
122+
echo 256K > /sys/block/zram0/mem_limit
123+
echo 512M > /sys/block/zram0/mem_limit
124+
echo 1G > /sys/block/zram0/mem_limit
125+
126+
# To disable memory limit
127+
echo 0 > /sys/block/zram0/mem_limit
129128

130129
6) Activate:
131130
mkswap /dev/zram0

0 commit comments

Comments
 (0)