Skip to content

Commit c87d165

Browse files
sergey-senozhatskytorvalds
authored andcommitted
zram: remove obsolete sysfs attrs
We had a deprecated_attr_warn() warning for 2 years and now the time has come and we finally can do the cleanup. The plan was as follows: : per-stat sysfs attributes are considered to be deprecated. : The basic strategy is: : -- the existing RW nodes will be downgraded to WO nodes (in linux 4.11) : -- deprecated RO sysfs nodes will eventually be removed (in linux 4.11) : : The list of deprecated attributes can be found here: : Documentation/ABI/obsolete/sysfs-block-zram : : Basically, every attribute that has its own read accessible sysfs : node (e.g. num_reads) *AND* is accessible via one of the stat files : (zram<id>/stat or zram<id>/io_stat or zram<id>/mm_stat) is considered : to be deprecated. The patch also removes `obsolete/sysfs-block-zram', clean ups `testing/sysfs-block-zram' and tweaks zram.txt files. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Sergey Senozhatsky <[email protected]> Acked-by: Minchan Kim <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 5d63f81 commit c87d165

File tree

4 files changed

+42
-353
lines changed

4 files changed

+42
-353
lines changed

Documentation/ABI/obsolete/sysfs-block-zram

Lines changed: 0 additions & 119 deletions
This file was deleted.

Documentation/ABI/testing/sysfs-block-zram

Lines changed: 8 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,6 @@ Description:
2222
device. The reset operation frees all the memory associated
2323
with this device.
2424

25-
What: /sys/block/zram<id>/num_reads
26-
Date: August 2010
27-
Contact: Nitin Gupta <[email protected]>
28-
Description:
29-
The num_reads file is read-only and specifies the number of
30-
reads (failed or successful) done on this device.
31-
32-
What: /sys/block/zram<id>/num_writes
33-
Date: August 2010
34-
Contact: Nitin Gupta <[email protected]>
35-
Description:
36-
The num_writes file is read-only and specifies the number of
37-
writes (failed or successful) done on this device.
38-
39-
What: /sys/block/zram<id>/invalid_io
40-
Date: August 2010
41-
Contact: Nitin Gupta <[email protected]>
42-
Description:
43-
The invalid_io file is read-only and specifies the number of
44-
non-page-size-aligned I/O requests issued to this device.
45-
46-
What: /sys/block/zram<id>/failed_reads
47-
Date: February 2014
48-
Contact: Sergey Senozhatsky <[email protected]>
49-
Description:
50-
The failed_reads file is read-only and specifies the number of
51-
failed reads happened on this device.
52-
53-
What: /sys/block/zram<id>/failed_writes
54-
Date: February 2014
55-
Contact: Sergey Senozhatsky <[email protected]>
56-
Description:
57-
The failed_writes file is read-only and specifies the number of
58-
failed writes happened on this device.
59-
6025
What: /sys/block/zram<id>/max_comp_streams
6126
Date: February 2014
6227
Contact: Sergey Senozhatsky <[email protected]>
@@ -73,74 +38,24 @@ Description:
7338
available and selected compression algorithms, change
7439
compression algorithm selection.
7540

76-
What: /sys/block/zram<id>/notify_free
77-
Date: August 2010
78-
Contact: Nitin Gupta <[email protected]>
79-
Description:
80-
The notify_free file is read-only. Depending on device usage
81-
scenario it may account a) the number of pages freed because
82-
of swap slot free notifications or b) the number of pages freed
83-
because of REQ_DISCARD requests sent by bio. The former ones
84-
are sent to a swap block device when a swap slot is freed, which
85-
implies that this disk is being used as a swap disk. The latter
86-
ones are sent by filesystem mounted with discard option,
87-
whenever some data blocks are getting discarded.
88-
89-
What: /sys/block/zram<id>/zero_pages
90-
Date: August 2010
91-
Contact: Nitin Gupta <[email protected]>
92-
Description:
93-
The zero_pages file is read-only and specifies number of zero
94-
filled pages written to this disk. No memory is allocated for
95-
such pages.
96-
97-
What: /sys/block/zram<id>/orig_data_size
98-
Date: August 2010
99-
Contact: Nitin Gupta <[email protected]>
100-
Description:
101-
The orig_data_size file is read-only and specifies uncompressed
102-
size of data stored in this disk. This excludes zero-filled
103-
pages (zero_pages) since no memory is allocated for them.
104-
Unit: bytes
105-
106-
What: /sys/block/zram<id>/compr_data_size
107-
Date: August 2010
108-
Contact: Nitin Gupta <[email protected]>
109-
Description:
110-
The compr_data_size file is read-only and specifies compressed
111-
size of data stored in this disk. So, compression ratio can be
112-
calculated using orig_data_size and this statistic.
113-
Unit: bytes
114-
115-
What: /sys/block/zram<id>/mem_used_total
116-
Date: August 2010
117-
Contact: Nitin Gupta <[email protected]>
118-
Description:
119-
The mem_used_total file is read-only and specifies the amount
120-
of memory, including allocator fragmentation and metadata
121-
overhead, allocated for this disk. So, allocator space
122-
efficiency can be calculated using compr_data_size and this
123-
statistic.
124-
Unit: bytes
125-
12641
What: /sys/block/zram<id>/mem_used_max
12742
Date: August 2014
12843
Contact: Minchan Kim <[email protected]>
12944
Description:
130-
The mem_used_max file is read/write and specifies the amount
131-
of maximum memory zram have consumed to store compressed data.
132-
For resetting the value, you should write "0". Otherwise,
133-
you could see -EINVAL.
45+
The mem_used_max file is write-only and is used to reset
46+
the counter of maximum memory zram have consumed to store
47+
compressed data. For resetting the value, you should write
48+
"0". Otherwise, you could see -EINVAL.
13449
Unit: bytes
13550

13651
What: /sys/block/zram<id>/mem_limit
13752
Date: August 2014
13853
Contact: Minchan Kim <[email protected]>
13954
Description:
140-
The mem_limit file is read/write and specifies the maximum
141-
amount of memory ZRAM can use to store the compressed data. The
142-
limit could be changed in run time and "0" means disable the
143-
limit. No limit is the initial state. Unit: bytes
55+
The mem_limit file is write-only and specifies the maximum
56+
amount of memory ZRAM can use to store the compressed data.
57+
The limit could be changed in run time and "0" means disable
58+
the limit. No limit is the initial state. Unit: bytes
14459

14560
What: /sys/block/zram<id>/compact
14661
Date: August 2015

Documentation/blockdev/zram.txt

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -161,42 +161,14 @@ Name access description
161161
disksize RW show and set the device's disk size
162162
initstate RO shows the initialization state of the device
163163
reset WO trigger device reset
164-
num_reads RO the number of reads
165-
failed_reads RO the number of failed reads
166-
num_write RO the number of writes
167-
failed_writes RO the number of failed writes
168-
invalid_io RO the number of non-page-size-aligned I/O requests
164+
mem_used_max WO reset the `mem_used_max' counter (see later)
165+
mem_limit WO specifies the maximum amount of memory ZRAM can use
166+
to store the compressed data
169167
max_comp_streams RW the number of possible concurrent compress operations
170168
comp_algorithm RW show and change the compression algorithm
171-
notify_free RO the number of notifications to free pages (either
172-
slot free notifications or REQ_DISCARD requests)
173-
zero_pages RO the number of zero filled pages written to this disk
174-
orig_data_size RO uncompressed size of data stored in this disk
175-
compr_data_size RO compressed size of data stored in this disk
176-
mem_used_total RO the amount of memory allocated for this disk
177-
mem_used_max RW the maximum amount of memory zram have consumed to
178-
store the data (to reset this counter to the actual
179-
current value, write 1 to this attribute)
180-
mem_limit RW the maximum amount of memory ZRAM can use to store
181-
the compressed data
182-
pages_compacted RO the number of pages freed during compaction
183-
(available only via zram<id>/mm_stat node)
184169
compact WO trigger memory compaction
185170
debug_stat RO this file is used for zram debugging purposes
186171

187-
WARNING
188-
=======
189-
per-stat sysfs attributes are considered to be deprecated.
190-
The basic strategy is:
191-
-- the existing RW nodes will be downgraded to WO nodes (in linux 4.11)
192-
-- deprecated RO sysfs nodes will eventually be removed (in linux 4.11)
193-
194-
The list of deprecated attributes can be found here:
195-
Documentation/ABI/obsolete/sysfs-block-zram
196-
197-
Basically, every attribute that has its own read accessible sysfs node
198-
(e.g. num_reads) *AND* is accessible via one of the stat files (zram<id>/stat
199-
or zram<id>/io_stat or zram<id>/mm_stat) is considered to be deprecated.
200172

201173
User space is advised to use the following files to read the device statistics.
202174

@@ -211,22 +183,40 @@ The stat file represents device's I/O statistics not accounted by block
211183
layer and, thus, not available in zram<id>/stat file. It consists of a
212184
single line of text and contains the following stats separated by
213185
whitespace:
214-
failed_reads
215-
failed_writes
216-
invalid_io
217-
notify_free
186+
failed_reads the number of failed reads
187+
failed_writes the number of failed writes
188+
invalid_io the number of non-page-size-aligned I/O requests
189+
notify_free Depending on device usage scenario it may account
190+
a) the number of pages freed because of swap slot free
191+
notifications or b) the number of pages freed because of
192+
REQ_DISCARD requests sent by bio. The former ones are
193+
sent to a swap block device when a swap slot is freed,
194+
which implies that this disk is being used as a swap disk.
195+
The latter ones are sent by filesystem mounted with
196+
discard option, whenever some data blocks are getting
197+
discarded.
218198

219199
File /sys/block/zram<id>/mm_stat
220200

221201
The stat file represents device's mm statistics. It consists of a single
222202
line of text and contains the following stats separated by whitespace:
223-
orig_data_size
224-
compr_data_size
225-
mem_used_total
226-
mem_limit
227-
mem_used_max
228-
zero_pages
229-
num_migrated
203+
orig_data_size uncompressed size of data stored in this disk.
204+
This excludes zero-filled pages (zero_pages) since no
205+
memory is allocated for them.
206+
Unit: bytes
207+
compr_data_size compressed size of data stored in this disk
208+
mem_used_total the amount of memory allocated for this disk. This
209+
includes allocator fragmentation and metadata overhead,
210+
allocated for this disk. So, allocator space efficiency
211+
can be calculated using compr_data_size and this statistic.
212+
Unit: bytes
213+
mem_limit the maximum amount of memory ZRAM can use to store
214+
the compressed data
215+
mem_used_max the maximum amount of memory zram have consumed to
216+
store the data
217+
zero_pages the number of zero filled pages written to this disk.
218+
No memory is allocated for such pages.
219+
pages_compacted the number of pages freed during compaction
230220

231221
9) Deactivate:
232222
swapoff /dev/zram0

0 commit comments

Comments
 (0)