← Documents Documentation/ABI/testing/sysfs-block-zram GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

ZRAM block device sysfs ABI

ZRAM device size·initialization·reset, compression과 memory limits, allocator compaction, I/O·memory·debug statistics, backing writeback, recompression과 algorithm parameters를 설명합니다.

Source pathDocumentation/ABI/testing/sysfs-block-zram
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

Device size, initialization과 reset

sysfs-block-zram:1-23

disksize는 저장 가능한 uncompressed data의 byte limit, initstate는 initialization state이며 reset은 device와 연결된 모든 memory를 해제합니다.

Primary compression과 memory management

sysfs-block-zram:25-58

comp_algorithm, mem_used_max, mem_limit과 compact가 algorithm selection, peak counter reset, runtime memory cap과 fragmented allocator space 회수를 제어합니다.

I/O, memory와 debug statistics

sysfs-block-zram:60-84

io_stat은 block layer 밖의 I/O statistics, mm_stat은 compression memory statistics, debug_stat은 안정된 format을 보장하지 않는 developer debugging information입니다.

Backing device와 idle·huge page writeback

sysfs-block-zram:86-115

backing_dev, idle, writeback과 bd_stat이 incompressible page용 storage, idle slot marking, idle·huge page writeback과 backing-device counters를 제공합니다.

Runtime writeback limit

sysfs-block-zram:117-131

writeback_limit_enable과 writeback_limit은 writeback cap feature와 runtime maximum amount를 제어하며 initial state는 limit가 없는 0입니다.

Secondary recompression과 algorithm parameters

sysfs-block-zram:133-152

recomp_algorithm은 secondary compression algorithms를 설정·표시하고 recompress는 이를 이용한 re-compression을 시작하며 algorithm_params는 compression parameters를 설정합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 What: /sys/block/zram<id>/disksize
2 Date: August 2010
3 Contact: Nitin Gupta <[email protected]>
4 Description:
5 The disksize file is read-write and specifies the disk size
6 which represents the limit on the *uncompressed* worth of data
7 that can be stored in this disk.
8 Unit: bytes
9
10 What: /sys/block/zram<id>/initstate
11 Date: August 2010
12 Contact: Nitin Gupta <[email protected]>
13 Description:
14 The initstate file is read-only and shows the initialization
15 state of the device.
16
17 What: /sys/block/zram<id>/reset
18 Date: August 2010
19 Contact: Nitin Gupta <[email protected]>
20 Description:
21 The reset file is write-only and allows resetting the
22 device. The reset operation frees all the memory associated
23 with this device.
24
25 What: /sys/block/zram<id>/comp_algorithm
26 Date: February 2014
27 Contact: Sergey Senozhatsky <[email protected]>
28 Description:
29 The comp_algorithm file is read-write and lets to show
30 available and selected compression algorithms, change
31 compression algorithm selection.
32
33 What: /sys/block/zram<id>/mem_used_max
34 Date: August 2014
35 Contact: Minchan Kim <[email protected]>
36 Description:
37 The mem_used_max file is write-only and is used to reset
38 the counter of maximum memory zram have consumed to store
39 compressed data. For resetting the value, you should write
40 "0". Otherwise, you could see -EINVAL.
41 Unit: bytes
42
43 What: /sys/block/zram<id>/mem_limit
44 Date: August 2014
45 Contact: Minchan Kim <[email protected]>
46 Description:
47 The mem_limit file is write-only and specifies the maximum
48 amount of memory ZRAM can use to store the compressed data.
49 The limit could be changed in run time and "0" means disable
50 the limit. No limit is the initial state. Unit: bytes
51
52 What: /sys/block/zram<id>/compact
53 Date: August 2015
54 Contact: Minchan Kim <[email protected]>
55 Description:
56 The compact file is write-only and trigger compaction for
57 allocator zrm uses. The allocator moves some objects so that
58 it could free fragment space.
59
60 What: /sys/block/zram<id>/io_stat
61 Date: August 2015
62 Contact: Sergey Senozhatsky <[email protected]>
63 Description:
64 The io_stat file is read-only and accumulates device's I/O
65 statistics not accounted by block layer. For example,
66 failed_reads, failed_writes, etc. File format is similar to
67 block layer statistics file format.
68
69 What: /sys/block/zram<id>/mm_stat
70 Date: August 2015
71 Contact: Sergey Senozhatsky <[email protected]>
72 Description:
73 The mm_stat file is read-only and represents device's mm
74 statistics (orig_data_size, compr_data_size, etc.) in a format
75 similar to block layer statistics file format.
76
77 What: /sys/block/zram<id>/debug_stat
78 Date: July 2016
79 Contact: Sergey Senozhatsky <[email protected]>
80 Description:
81 The debug_stat file is read-only and represents various
82 device's debugging info useful for kernel developers. Its
83 format is not documented intentionally and may change
84 anytime without any notice.
85
86 What: /sys/block/zram<id>/backing_dev
87 Date: June 2017
88 Contact: Minchan Kim <[email protected]>
89 Description:
90 The backing_dev file is read-write and set up backing
91 device for zram to write incompressible pages.
92 For using, user should enable CONFIG_ZRAM_WRITEBACK.
93
94 What: /sys/block/zram<id>/idle
95 Date: November 2018
96 Contact: Minchan Kim <[email protected]>
97 Description:
98 idle file is write-only and mark zram slot as idle.
99 If system has mounted debugfs, user can see which slots
100 are idle via /sys/kernel/debug/zram/zram<id>/block_state
101
102 What: /sys/block/zram<id>/writeback
103 Date: November 2018
104 Contact: Minchan Kim <[email protected]>
105 Description:
106 The writeback file is write-only and trigger idle and/or
107 huge page writeback to backing device.
108
109 What: /sys/block/zram<id>/bd_stat
110 Date: November 2018
111 Contact: Minchan Kim <[email protected]>
112 Description:
113 The bd_stat file is read-only and represents backing device's
114 statistics (bd_count, bd_reads, bd_writes) in a format
115 similar to block layer statistics file format.
116
117 What: /sys/block/zram<id>/writeback_limit_enable
118 Date: November 2018
119 Contact: Minchan Kim <[email protected]>
120 Description:
121 The writeback_limit_enable file is read-write and specifies
122 eanbe of writeback_limit feature. "1" means eable the feature.
123 No limit "0" is the initial state.
124
125 What: /sys/block/zram<id>/writeback_limit
126 Date: November 2018
127 Contact: Minchan Kim <[email protected]>
128 Description:
129 The writeback_limit file is read-write and specifies the maximum
130 amount of writeback ZRAM can do. The limit could be changed
131 in run time.
132
133 What: /sys/block/zram<id>/recomp_algorithm
134 Date: November 2022
135 Contact: Sergey Senozhatsky <[email protected]>
136 Description:
137 The recomp_algorithm file is read-write and allows to set
138 or show secondary compression algorithms.
139
140 What: /sys/block/zram<id>/recompress
141 Date: November 2022
142 Contact: Sergey Senozhatsky <[email protected]>
143 Description:
144 The recompress file is write-only and triggers re-compression
145 with secondary compression algorithms.
146
147 What: /sys/block/zram<id>/algorithm_params
148 Date: August 2024
149 Contact: Sergey Senozhatsky <[email protected]>
150 Description:
151 The algorithm_params file is write-only and is used to setup
152 compression algorithm parameters.
153

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

ZRAM disk size, initialization과 reset

1-23
WhatDateContact전문 번역
/sys/block/zram<id>/disksize2010년 8월Nitin Gupta <[email protected]>disksize file은 read-write이며 이 disk에 저장할 수 있는 uncompressed data 상당량의 limit를 나타내는 disk size를 지정합니다. 단위는 bytes입니다.
/sys/block/zram<id>/initstate2010년 8월Nitin Gupta <[email protected]>initstate file은 read-only이며 device의 initialization state를 보여 줍니다.
/sys/block/zram<id>/reset2010년 8월Nitin Gupta <[email protected]>reset file은 write-only이며 device를 reset할 수 있게 합니다. Reset operation은 이 device와 연결된 모든 memory를 해제합니다.
ZRAM device lifecycle
Set disksize in bytesInitialize ZRAM deviceStore compressed dataWrite resetFree all associated memory
initstateRead current initialization state

Uncompressed logical capacity를 정하고 device를 사용한 뒤 reset으로 모든 관련 memory를 해제하는 lifecycle이다.

Compression algorithm과 memory control

25-58
WhatDateContact전문 번역
/sys/block/zram<id>/comp_algorithm2014년 2월Sergey Senozhatsky <[email protected]>comp_algorithm file은 read-write이며 available compression algorithm과 selected compression algorithm을 보여 주고 compression algorithm selection을 변경할 수 있게 합니다.
/sys/block/zram<id>/mem_used_max2014년 8월Minchan Kim <[email protected]>mem_used_max file은 write-only이며 compressed data를 저장하기 위해 ZRAM이 소비한 maximum memory counter를 reset하는 데 사용합니다. 값을 reset하려면 "0"을 써야 합니다. 그 밖의 값을 쓰면 -EINVAL이 발생할 수 있습니다. 단위는 bytes입니다.
/sys/block/zram<id>/mem_limit2014년 8월Minchan Kim <[email protected]>mem_limit file은 write-only이며 compressed data를 저장할 때 ZRAM이 사용할 수 있는 maximum memory amount를 지정합니다. Limit는 runtime에 변경할 수 있고 "0"은 limit를 disable한다는 뜻입니다. Initial state에는 limit가 없습니다. 단위는 bytes입니다.
/sys/block/zram<id>/compact2015년 8월Minchan Kim <[email protected]>compact file은 write-only이며 ZRAM이 사용하는 allocator의 compaction을 trigger합니다. Allocator가 일부 object를 이동하여 fragmented space를 해제할 수 있게 합니다.
Attribute특수 입력결과
mem_used_max0Maximum consumed-memory counter reset
mem_used_max0 이외-EINVAL 가능
mem_limit0Memory limit disable
mem_limitbyte 값Runtime maximum memory 변경

ZRAM I/O, memory와 debug statistics

60-84
WhatDateContact전문 번역
/sys/block/zram<id>/io_stat2015년 8월Sergey Senozhatsky <[email protected]>io_stat file은 read-only이며 block layer가 account하지 않는 device I/O statistics를 누적합니다. failed_reads, failed_writes 등이 그 예입니다. File format은 block layer statistics file format과 비슷합니다.
/sys/block/zram<id>/mm_stat2015년 8월Sergey Senozhatsky <[email protected]>mm_stat file은 read-only이며 orig_data_size, compr_data_size 같은 device memory-management statistics를 block layer statistics file format과 비슷한 format으로 나타냅니다.
/sys/block/zram<id>/debug_stat2016년 7월Sergey Senozhatsky <[email protected]>debug_stat file은 read-only이며 kernel developer에게 유용한 다양한 device debugging information을 나타냅니다. 이 format은 의도적으로 document하지 않으며 어떤 notice도 없이 언제든 바뀔 수 있습니다.

Backing device, idle slots와 writeback

86-115
WhatDateContact전문 번역
/sys/block/zram<id>/backing_dev2017년 6월Minchan Kim <[email protected]>backing_dev file은 read-write이며 ZRAM이 incompressible page를 기록할 backing device를 setup합니다. 사용하려면 CONFIG_ZRAM_WRITEBACK을 enable해야 합니다.
/sys/block/zram<id>/idle2018년 11월Minchan Kim <[email protected]>idle file은 write-only이며 ZRAM slot을 idle로 mark합니다. System에 debugfs가 mount되어 있다면 /sys/kernel/debug/zram/zram<id>/block_state에서 어떤 slot이 idle인지 볼 수 있습니다.
/sys/block/zram<id>/writeback2018년 11월Minchan Kim <[email protected]>writeback file은 write-only이며 idle page 및/또는 huge page를 backing device로 writeback하도록 trigger합니다.
/sys/block/zram<id>/bd_stat2018년 11월Minchan Kim <[email protected]>bd_stat file은 read-only이며 bd_count, bd_reads, bd_writes 같은 backing device statistics를 block layer statistics file format과 비슷한 format으로 나타냅니다.
ZRAM memory와 backing writeback
Incoming pagePrimary compressionCompressed ZRAM memory
Incompressible pageCONFIG_ZRAM_WRITEBACKbacking_dev
Mark slot idleWrite writebackIdle or huge pageBacking device
Backing-device activitybd_stat counters

Compressible data는 memory에 유지하고 incompressible·idle·huge pages는 configured backing device로 이동할 수 있다.

Writeback amount 제한

117-131
WhatDateContact전문 번역
/sys/block/zram<id>/writeback_limit_enable2018년 11월Minchan Kim <[email protected]>writeback_limit_enable file은 read-write이며 writeback_limit feature를 enable할지 지정합니다. "1"은 feature enable을 뜻합니다. Limit가 없는 "0"이 initial state입니다.
/sys/block/zram<id>/writeback_limit2018년 11월Minchan Kim <[email protected]>writeback_limit file은 read-write이며 ZRAM이 수행할 수 있는 maximum writeback amount를 지정합니다. Limit는 runtime에 변경할 수 있습니다.
writeback_limit_enable의미
0Writeback limit 없음(initial state)
1writeback_limit feature enable

Secondary compression과 parameters

133-152
WhatDateContact전문 번역
/sys/block/zram<id>/recomp_algorithm2022년 11월Sergey Senozhatsky <[email protected]>recomp_algorithm file은 read-write이며 secondary compression algorithm을 설정하거나 보여 줄 수 있게 합니다.
/sys/block/zram<id>/recompress2022년 11월Sergey Senozhatsky <[email protected]>recompress file은 write-only이며 secondary compression algorithm을 사용한 re-compression을 trigger합니다.
/sys/block/zram<id>/algorithm_params2024년 8월Sergey Senozhatsky <[email protected]>algorithm_params file은 write-only이며 compression algorithm parameters를 setup하는 데 사용합니다.
Primary compression과 recompression
comp_algorithmSelect primary algorithmCompress incoming data
recomp_algorithmSelect secondary algorithmsWrite recompressRe-compress stored data
algorithm_paramsConfigure compression parameters

Initial compression 이후 secondary algorithm을 선택해 existing compressed data를 다시 압축하는 control path이다.