11========================================
2- zram: Compressed RAM based block devices
2+ zram: Compressed RAM- based block devices
33========================================
44
55Introduction
66============
77
8- The zram module creates RAM based block devices named /dev/zram<id>
8+ The zram module creates RAM- based block devices named /dev/zram<id>
99(<id> = 0, 1, ...). Pages written to these disks are compressed and stored
1010in memory itself. These disks allow very fast I/O and compression provides
11- good amounts of memory savings. Some of the usecases include /tmp storage,
12- use as swap disks, various caches under /var and maybe many more :)
11+ good amounts of memory savings. Some of the use cases include /tmp storage,
12+ use as swap disks, various caches under /var and maybe many more. :)
1313
1414Statistics for individual zram devices are exported through sysfs nodes at
1515/sys/block/zram<id>/
@@ -43,17 +43,17 @@ The list of possible return codes:
4343
4444======== =============================================================
4545-EBUSY an attempt to modify an attribute that cannot be changed once
46- the device has been initialised. Please reset device first;
46+ the device has been initialised. Please reset device first.
4747-ENOMEM zram was not able to allocate enough memory to fulfil your
48- needs;
48+ needs.
4949-EINVAL invalid input has been provided.
5050======== =============================================================
5151
52- If you use 'echo', the returned value that is changed by 'echo' utility,
52+ If you use 'echo', the returned value is set by the 'echo' utility,
5353and, in general case, something like::
5454
5555 echo 3 > /sys/block/zram0/max_comp_streams
56- if [ $? -ne 0 ];
56+ if [ $? -ne 0 ]; then
5757 handle_error
5858 fi
5959
@@ -65,20 +65,21 @@ should suffice.
6565::
6666
6767 modprobe zram num_devices=4
68- This creates 4 devices: /dev/zram{0,1,2,3}
68+
69+ This creates 4 devices: /dev/zram{0,1,2,3}
6970
7071num_devices parameter is optional and tells zram how many devices should be
7172pre-created. Default: 1.
7273
73742) Set max number of compression streams
7475========================================
7576
76- Regardless the value passed to this attribute, ZRAM will always
77- allocate multiple compression streams - one per online CPUs - thus
77+ Regardless of the value passed to this attribute, ZRAM will always
78+ allocate multiple compression streams - one per online CPU - thus
7879allowing several concurrent compression operations. The number of
7980allocated compression streams goes down when some of the CPUs
8081become offline. There is no single-compression-stream mode anymore,
81- unless you are running a UP system or has only 1 CPU online.
82+ unless you are running a UP system or have only 1 CPU online.
8283
8384To find out how many streams are currently available::
8485
@@ -89,7 +90,7 @@ To find out how many streams are currently available::
8990
9091Using comp_algorithm device attribute one can see available and
9192currently selected (shown in square brackets) compression algorithms,
92- change selected compression algorithm (once the device is initialised
93+ or change the selected compression algorithm (once the device is initialised
9394there is no way to change compression algorithm).
9495
9596Examples::
@@ -167,9 +168,9 @@ Examples::
167168zram provides a control interface, which enables dynamic (on-demand) device
168169addition and removal.
169170
170- In order to add a new /dev/zramX device, perform read operation on hot_add
171- attribute. This will return either new device's device id (meaning that you
172- can use /dev/zram<id>) or error code.
171+ In order to add a new /dev/zramX device, perform a read operation on the hot_add
172+ attribute. This will return either the new device's device id (meaning that you
173+ can use /dev/zram<id>) or an error code.
173174
174175Example::
175176
@@ -186,8 +187,8 @@ execute::
186187
187188Per-device statistics are exported as various nodes under /sys/block/zram<id>/
188189
189- A brief description of exported device attributes. For more details please
190- read Documentation/ABI/testing/sysfs-block-zram.
190+ A brief description of exported device attributes follows . For more details
191+ please read Documentation/ABI/testing/sysfs-block-zram.
191192
192193====================== ====== ===============================================
193194Name access description
@@ -245,7 +246,7 @@ whitespace:
245246
246247File /sys/block/zram<id>/mm_stat
247248
248- The stat file represents device's mm statistics. It consists of a single
249+ The mm_stat file represents the device's mm statistics. It consists of a single
249250line of text and contains the following stats separated by whitespace:
250251
251252 ================ =============================================================
@@ -261,7 +262,7 @@ line of text and contains the following stats separated by whitespace:
261262 Unit: bytes
262263 mem_limit the maximum amount of memory ZRAM can use to store
263264 the compressed data
264- mem_used_max the maximum amount of memory zram have consumed to
265+ mem_used_max the maximum amount of memory zram has consumed to
265266 store the data
266267 same_pages the number of same element filled pages written to this disk.
267268 No memory is allocated for such pages.
@@ -271,7 +272,7 @@ line of text and contains the following stats separated by whitespace:
271272
272273File /sys/block/zram<id>/bd_stat
273274
274- The stat file represents device's backing device statistics. It consists of
275+ The bd_stat file represents a device's backing device statistics. It consists of
275276a single line of text and contains the following stats separated by whitespace:
276277
277278 ============== =============================================================
@@ -316,17 +317,17 @@ To use the feature, admin should set up backing device via::
316317 echo /dev/sda5 > /sys/block/zramX/backing_dev
317318
318319before disksize setting. It supports only partition at this moment.
319- If admin want to use incompressible page writeback, they could do via::
320+ If admin wants to use incompressible page writeback, they could do via::
320321
321- echo huge > /sys/block/zramX/write
322+ echo huge > /sys/block/zramX/writeback
322323
323324To use idle page writeback, first, user need to declare zram pages
324325as idle::
325326
326327 echo all > /sys/block/zramX/idle
327328
328329From now on, any pages on zram are idle pages. The idle mark
329- will be removed until someone request access of the block.
330+ will be removed until someone requests access of the block.
330331IOW, unless there is access request, those pages are still idle pages.
331332
332333Admin can request writeback of those idle pages at right timing via::
@@ -341,16 +342,16 @@ to guarantee storage health for entire product life.
341342
342343To overcome the concern, zram supports "writeback_limit" feature.
343344The "writeback_limit_enable"'s default value is 0 so that it doesn't limit
344- any writeback. IOW, if admin want to apply writeback budget, he should
345+ any writeback. IOW, if admin wants to apply writeback budget, he should
345346enable writeback_limit_enable via::
346347
347348 $ echo 1 > /sys/block/zramX/writeback_limit_enable
348349
349350Once writeback_limit_enable is set, zram doesn't allow any writeback
350- until admin set the budget via /sys/block/zramX/writeback_limit.
351+ until admin sets the budget via /sys/block/zramX/writeback_limit.
351352
352353(If admin doesn't enable writeback_limit_enable, writeback_limit's value
353- assigned via /sys/block/zramX/writeback_limit is meaninless .)
354+ assigned via /sys/block/zramX/writeback_limit is meaningless .)
354355
355356If admin want to limit writeback as per-day 400M, he could do it
356357like below::
@@ -361,26 +362,26 @@ like below::
361362 /sys/block/zram0/writeback_limit.
362363 $ echo 1 > /sys/block/zram0/writeback_limit_enable
363364
364- If admin want to allow further write again once the bugdet is exausted ,
365+ If admins want to allow further write again once the bugdet is exhausted ,
365366he could do it like below::
366367
367368 $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \
368369 /sys/block/zram0/writeback_limit
369370
370- If admin want to see remaining writeback budget since he set::
371+ If admin wants to see remaining writeback budget since last set::
371372
372373 $ cat /sys/block/zramX/writeback_limit
373374
374375If admin want to disable writeback limit, he could do::
375376
376377 $ echo 0 > /sys/block/zramX/writeback_limit_enable
377378
378- The writeback_limit count will reset whenever you reset zram(e.g.,
379+ The writeback_limit count will reset whenever you reset zram (e.g.,
379380system reboot, echo 1 > /sys/block/zramX/reset) so keeping how many of
380381writeback happened until you reset the zram to allocate extra writeback
381382budget in next setting is user's job.
382383
383- If admin want to measure writeback count in a certain period, he could
384+ If admin wants to measure writeback count in a certain period, he could
384385know it via /sys/block/zram0/bd_stat's 3rd column.
385386
386387memory tracking
0 commit comments